Dear Waldek,
In Stream, I see
-- This description of the rep is not quite true.
-- The Rep is a pair of one of three forms:
-- [value: S, rest: %]
-- [nullstream: Magic, NIL ]
-- [nonnullstream: Magic, fun: () -> %]
-- [uninitializedstream : Magic, 0]
-- Could use a record of unions if we could guarantee no tags.
NullStream : S := _$NullStream$Lisp pretend S
NonNullStream : S := _$NonNullStream$Lisp pretend S
UninitializedStream : S := _$UninitializedStream$Lisp pretend S
Rep := Record(firstElt : S, restOfStream : %)
https://github.com/fricas/fricas/blob/master/src/algebra/stream.spad#L626
And also
-- we have to use SPADCALL directly to avoid wrong code
lazyEval x == SPADCALL(rst(x))$Lisp pretend %
https://github.com/fricas/fricas/blob/master/src/algebra/stream.spad#L626
May I ask whether
lazyEval x == (rst(x) pretend () -> %)()
would actually also work? Or is it that what produces wrong code?
The idea in Stream's representation is anyway that values of type % and
values of type ()->% can be stored in the same record position.
I am asking, because that would eliminate an explicit SPADCALL$Lisp.
In fact, I'd be happy, if all the function that are Lisp-specific like
EQ$Lisp, APPEND$Lisp are defined at the beginning and then no further
...$Lisp will appear.
And as you said in another mail, obviously Stream is not as lazy as it
could be. Maybe a good task for a student who wants to program in SPAD.
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/7939ee2e-1225-5181-3bbe-1731c5331aec%40hemmecke.org.