MathAction #328 AXIOM interpreter cannot iterate over Stream



#328 AXIOM interpreter cannot iterate over Stream
last edited 10 years ago by test1

Submitted by : (unknown) at: 2007年11月17日T22:27:06-08:00 (18 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :
Optional comment :

fricas
(1) -> L := stream(s+->s+1,1.1)$Stream Float
Type: Stream(Float)
fricas
for i in L repeat
 output i+0.01
FriCAS cannot iterate with i over your form now. Perhaps you should try using a conversion to make sure your form is a list or stream, for example.

But of course L is a Stream and iteration within list comprehension works.

fricas
P:=[i+0.01 for i in L]
Type: Stream(Float)

The first loop is nonterminating (there is nothing to stop iteration), so it is good that interpreter rejects it. The problem is where to draw line between nonterminationg loops and terminating ones.

Note that list comprehension produces a stream which is quite different than the first loop (in particular, since streams are lazy there a no extra problem with termination).




Subject: Be Bold !!
( 15 subscribers )
Please rate this page:

AltStyle によって変換されたページ (->オリジナル) /