Fork me on GitHub
#portal
<
2023-12-15
>
markaddleman22:12:36

One more request: It would be nice to have a function equivalent of portal.console/debug to use in transducer pipelines.

markaddleman22:12:17

I find myself writing code like this:

(sequence (comp 
            ...
            (map (fn[x] (portal.console/debug x)))
            ...)
 ...)

djblue22:12:32

Can you have both a fn and macro version? Or do they need different names?

markaddleman22:12:52

I don’t understand

djblue22:12:55

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 :thinking_face:

markaddleman23:12:29

Right. My use case is entirely about transducer pipelines so maybe a macro would do the trick. Something like:

markaddleman23:12:48

(sequence (comp 
            ...
           (portal.console/debug-xf)
            ...)
 ...)

djblue23:12:18

Ohh you still call the code, but it returns a transduce instead 👌

djblue23:12:42

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>?

markaddleman23:12:02

I like that a lot

djblue23:12:56

Did you want to submit a PR?

markaddleman23:12:10

Sure. I’ll put one together this weekend

djblue23:12:23

Awesome, thanks!

djblue23:12:04

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.

djblue23:12:42

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 😂

djblue23:12:40

Is there a way to globally refer a var into every ns? 😂