On Wed, Dec 14, 2011 at 04:53:33PM +0100, Waldek Hebisch wrote:
> Serge D. Mechveliani wrote:
> >
> > People,
> > there is a strange effect:
> >
> > ------------------------------------------
> > Put "2+3" to axInput.txt,
> >
> > -> iFile : File String := open("axInput.txt", "input")
> >
> > axInput.txt ...
> >
> > -> read! iFile
> >
> > (12) "2+3"
> > Type: String
> > (13) -> parse(%)$InputForm
> >
> > >> System error:
> > |2+3| is not of type SEQUENCE.
> > ---------------------------------------------------------
> >
> > The same is when the program transmits it as iStr = read! iFile
> > parse(iStr)$InputForm
> >
> > But parse("2+3")$InputForm evaluates to (+ 2 3) : InputForm.
> >
> > And according to the report of (12) "2+3"
> > Type: String,
> > % and ("2+3" : String) are the same.
> >
> > Where is the error? What is this `|' ?
> > Thank you in advance for explanation,
>
> AFAICS you have '2+3' without string quotes.
Sorry, I thought it was "2+3" in the file, but in reality it was
written there without double quotes.
Thank you.
> Note: due to type declarations print function "knows" it
> has string so puts string quotes around the result,
> but in fact argument is of wrong lowe levle type.
> By accident print function "works", but parse bombs.
`print' knows the type and also sees that the data does not match this
type. So, it applies coercion and then prints ?
(probably, this is natural, I do not know).
------
Sergei
[email protected]
--
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.