Continuing the conversation from https://clojurians.slack.com/archives/C03S1KBA2/p1702680404451899?thread_ts=1702674938.791789&cid=C03S1KBA2 β¦
One more request: It would be nice to have a function equivalent of portal.console/debug to use in transducer pipelines.
I find myself writing code like this:
(sequence (comp
...
(map (fn[x] (portal.console/debug x)))
...)
...)
Can you have both a fn and macro version? Or do they need different names?
I donβt understand
I was wondering if a var could have both a runtime fn and a macro, but that doesn't make sense. I guess the other issue here is that passing in a fn references doesn't allow for capturing the source context π€
Right. My use case is entirely about transducer pipelines so maybe a macro would do the trick. Something like:
(sequence (comp
...
(portal.console/debug-xf)
...)
...)
Ohh you still call the code, but it returns a transduce instead π
Yep!
I wonder if we can do it like the transducer collection fns. If you call the fn with no args it returns an "identity" transducer that calls tap>?
I like that a lot
Did you want to submit a PR?
Sure. Iβll put one together this weekend
Awesome, thanks!
Thank you!
In terms of the reader macro, I feel like it's coinvent but feels like a bit of a hack, which is why I haven't gotten around to doing it.
I feel like the main annoyance is having to ensure the ns is loaded and having to type out the full name all the time or alias it. tap> is so coinvent because it's always there and so short π
Is there a way to globally refer a var into every ns? π