portal 2023-12-15

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 πŸ‘Œ

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? πŸ˜‚