fricas L := stream(s+->s+1,
Type: Stream(Float)
fricas for i in L repeat output i+0.01 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). |