[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Axiom-developer] Re: [Axiom-mail] NNI to SingleInteger

**From**: |
Gernot Hueber |

**Subject**: |
[Axiom-developer] Re: [Axiom-mail] NNI to SingleInteger |

**Date**: |
Tue, 28 Nov 2006 10:01:01 +0100 |

`Hi Ralf,
``
``Ralf writes:
``
``Hello,
``
``does somebody know the proper method/function to convert between
``
``NNI, PI, SingleInteger, Integer
``
`Complete conversion graph would be interesting.

`Note that I am *not* interested in interpreter stuff. I want to know the
``explicit functions that I have to call in a .as file, i.e. the functions
``should live inside libaxiom.al. If possible I want to avoid the use of
``"pretend".
`

`Sorry no graph, no explanation, only the practical approach.
``
``BR Gernot
``
`
<----- begin code ------->
#include "axiom.as"

`#pile
``
`INT ==> Integer;
NNI ==> NonNegativeInteger;
SI ==> SingleInteger;

`PI ==> PositiveInteger;
``
`test(i: INT):INT == {

`import from INT, SI, PI, NNI;
``
`-- INT -> all
si1:SI := i::SI;
pi1:PI := i::PI;

`nni1:NNI := i::NNI;
``
`-- SI -> all
int2:INT := si1::INT;
pi2:PI := si1::PI;

`nni2:NNI := si1::NNI;
``
`--> NNI -> all
int3:INT := nni1::INT;
pi3:PI := nni1::PI;

`si2:SI := nni1::SI;
``
`i;
}

`<----- end code ------->
``
`

`Yesterday, I have tried
``
``coerce: % -> PrimitiveArray S;
``
``from Tuple(S), but the Aldor compiler doesn't seem to know that this
``coercion exists. Any hints?
``
``Furthermore, Tuple in Axiom has the function "select" for accessing the
``n-th element of the tuple. Unfortunately, "select" is a reserved keyword
``in Aldor. What should I do?
``
``Thank you in advance.
``
``Ralf
``
`
_______________________________________________
Axiom-mail mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/axiom-mail