I tried to do the following in Clojure
(map future exprs)
To get a seq of future tokens. Unfortunately this errs because future is itself a macro, not a function.
Is there a way to make this work while still maintaining the map syntax? I’d rather not use the for macro (just as a matter of personal style).
I suppose I’m looking for a mmap or macro map.
As already stated by Marcin, use a lambda (anonymous function)
edit
By the way, if you’re using
mapto create a bunch of tasks to be executed in other threads, you might have issues.mapis lazy, and the futures won’t be created until something asks for them. You would need to force it to be evaluated (which is what happens in the repl when the repl prints the result) or find some other way.