Fork me on GitHub
#clojurescript
<
2023-01-13
>
Raymond Ko16:01:00

Does anyone have an example of the use of the new iteration function with async/Promises (for network requests)?

moe18:01:43

I don't see that working out if you're not going to block

moe18:01:49

Oh, right, this is #C03S1L9DN, you can't block

moe18:01:23

iteration depends on being able to be passed functions which can introspect the values returned by your step function. If it's asynchronous, you're not going to be able to do that without returning promises / deferred values, which will be opaque to iteration

lilactown19:01:39

I did an experiment with https://github.com/lilactown/async-seq/blob/main/dev/user.cljs because of my frustration that iteration is pretty useless in CLJS for the type of usecases it's great for in Clojure 😅

lilactown19:01:56

might be interesting to you

lilactown19:01:31

in JS, this is something that async generators is good for too