Fork me on GitHub
#core-async
<
2016-10-03
>
josh.freckleton19:10:10

is there an a/map but meant more fore side-effecting? I have a channel I want to map over, but I don't care about returning anything, and the fn passed to my "`map`" is useful only for it's side-effects.

exupero19:10:49

The single-arity version of map gives you a transducer, and transduce is eager so it supports side effects. See https://stuartsierra.com/2015/08/25/clojure-donts-lazy-effects. I would probably just use loop/`recur` and call the function.

hlolli20:10:27

would someone consider this to be a bug, or just "you shouldn't do it" kinda thing?

(defmacro bug-loop []
  (go-loop []))
(bug-loop)
=> java.lang.IllegalArgumentException
   Unable to resolve classname: LinkedList

ghadi20:10:24

you're running a go-loop during macroexpansion, did you mean to quote

`(go-loop [])

ghadi20:10:46

either way - "you shouldn't do it" 🙂

hlolli20:10:00

yes, I did quote, but Im doing a macro where I convert symbols to text, so as soon as its quoted and unquoted everything goes south. Im doing so much macro hacking that I would rather nobody knew about it (and nobody will see it except me). I can use normal loop in this case. But if a go-loop should work like this is 99,999% no problem for anyone.

hlolli20:10:19

same goes for go inside macro but not <!! or any other async function.