Question

Context

The following code infinite loops:

(defn ex13 []
  (take 5
        (run* [x]
       (listo (lcons `a (lcons `b (lcons `c x)))))))

Question:

Is this supposed to be the right behavior? (infinite looping?) On the other hand, code like:

(take 5 (range))

takes 5 elements and prints them out.

Was it helpful?

Solution

This may be a bug, however that's not the right way to do it as the results of run* are not truly lazy anyhow.

(run 5 [x]
   (listo (lcons `a (lcons `b (lcons `c x)))))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top