Anthony Borla writes:
 > Greetings,
 > 
 > Ouput from the following code:
 > 
 >   {System.showInfo ~1}          %% (1)
 >   {System.showInfo ~1.0}       %% (2)
 > 
 >   {System.showInfo {VirtualString.changeSign {IntToString ~1} &-}}
 >   {System.showInfo {VirtualString.changeSign {IntToString ~1} "-"}}
 > 
 > is:
 > 
 >   -1
 >   -1.0
 >   ~1
 >   ~1
 > 
 > Obviously some sort of implicit conversion is being performed at (1) and
 > (2). 

I am a bit confused about your question.  ~1 is the lexical string
that reprsents -1.  So the lexer/parser turns the string ~1 into an
internal value of -1.  ShowInfo prints -1 as the string "-1"

This behaviour is sort of hinted at in the documentation of
VirtualString.toString: 

" The transformation is straightforward: Atoms (except nil and '#'),
  integers, floats and byte strings are transformed into strings using
  Atom.toString, Int.toString, Float.toString, and ByteString.toString
  respectively, where in numbers - is used instead of ~."

IntToString converts the value -1 into the string "~1" (as per
documentation it converts to a string in Oz Concrete syntax)

 > My question is: what routine(s) need to be called in order to
 > explicitly perform this task ?
 > 

What task do you want to perform?

 > I would have thought it was 'VirtualString.changeSign', but all my attempts
 > to so use it are failing.
 > 

See the difference in:

{System.showInfo ~3.14}
{System.showInfo {VirtualString.changeSign ~3.14 '~'}}

Hope this helps
k



_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to