Ralf Hemmecke
unread,Jul 24, 2024, 4:30:12 PM7/24/24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fricas-devel
The attached program results in the output given below.
Why is revb3 showing the empty list whereas lb3 does not?
Interestingly, when I remove the line marked with ***, then the output
for revb3 comes out as expected (see second session below).
It seems like assignment to "revb" inside "delay" is creating a new
variable revb that is not the same as the argument of restRecip. That's
the only possible explanation I can come up with.
Ralf
-- first session --
%%% (1) -> )co foo.spad
%%% (1) -> S ==> Stream Fraction Integer
%%% (2) -> )set stream calc 4
%%% (2) -> s: S := [i for i in 1..]
(2) [1, 2, 3, 4, ...]
%%% (3) -> un := (recip_new s)$Foo(Fraction Integer);
[:> , revb, [1]]
[:> , revb2, [1]]
[:> , lb2, [1]]
%%% (4) -> sn := un :: S;
%%% (5) -> sn.2
[:> , revb3, []]
[:> , lb3, [1]]
[:> , zero? bn, true]
[:> , revb, []]
[:> , revb2, []]
[:> , lb2, []]
(5) 0
-- second session
%%% (1) -> )co foo.spad
%%% (1) -> S ==> Stream Fraction Integer
%%% (2) -> )set stream calc 4
%%% (2) -> s: S := [i for i in 1..]
(2) [1, 2, 3, 4, ...]
%%% (3) -> un := (recip_new s)$Foo(Fraction Integer);
[:> , revb, [1]]
[:> , revb2, [1]]
[:> , lb2, [1]]
%%% (4) -> sn := un :: S;
%%% (5) -> sn.2
[:> , revb3, [1]]
[:> , lb3, [1]]
[:> , zero? bn, true]
[:> , revb, [1]]
[:> , revb2, [1]]
[:> , lb2, [1]]
(5) 0