|
|
last edited 9 years ago by test1 |
1 2 | ||
Editor: test1
Time: 2014/12/16 17:38:55 GMT+0 |
||
Note: |
changed: -L:=generate(s+->s+1,1.1)$Stream Float L := stream(s+->s+1,1.1)$Stream Float added: 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).
L := stream(s+->s+1,1.1)$Stream Float
(1) |
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.
P:=[i+0.01 for i in L]
(2) |
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).