Replies: 4 comments 1 reply
-
|
Well I am not sure about your usecase, but there is a simple example: Do not forget it is a macro, so expression is like body for do. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks, @pepe . As for a use case, suppose I want to generate a list of numbers that keep doubling, like 2, 4, 8, 16, ... up until some max-val. I think I understand that you can use So, to get that doubling-number list, I tried this: (var n 2)
(defn foo
[x]
(* x 2))
(loop [n :iterate (foo n)
:while (< n 1000)]
(pp n))but it's just sticking at n = 4 and endlessly looping. How do I get the variable in the loop to update to the new value of |
Beta Was this translation helpful? Give feedback.
-
|
I think there may be an issue with at least one of the uses of Perhaps the following is closer to what you want? |
Beta Was this translation helpful? Give feedback.
-
|
Hm. So, the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What is the purpose of :iterate in a general purpose
loop, and how do I use it?If I do:
it forever loops on
n= 1 withmbeing a different function object each time. What's going on there?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions