import Character
      zero := ord(char("0")) pretend SI

      parseInt(str : String) : I ==
           b := zero
           l   :=  # str  pretend SI
           s   :=  0      :: I
           ten :=  10     :: I
           for i in (1 .. l) repeat
                             dNum := (ord(qelt(str, i)) pretend SI) - b
                             s    := (ten*s) + dNum
           s

Waldek, I don't understand, why you have put "pretend SI" there. I assume by SI you mean SingleInteger.

From what I know, SingleInteger (or MachineInteger in libaldor) need not (does not) have the same representation as Integer.

That you code does what you expect, might have (at least) 3 reasons.
1) In the underlying lisp SingleInteger and Integer have the same representation
2) In SPAD SingleInteger and Integer have the same representation.
3) "pretend SI" is not simply a "pretend" but is actually doing some casting operation, i.e. a runtime operation. (It's not in Aldor as far as I know.)

I would have expected something like "::SingleInteger", since there is a function "coerce: Integer->%" in SingleInteger.

Ralf

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to