Fork me on GitHub

A guess all my talks are Assums?


Oh, and good morning!


Morsning korsning!


good, bright and crisp morning


thanks to @borkdude and @mpenet for an eduction education this week


So with @borkdude’s and @slipset’s help I sort of get some of the rationale for transducers. Still need to understand the mechanics. I found the first course in a series about transducers by Tim Baldridge. But it didn't even reach the point where a transducer was used. 😃 I'll check that reference page out first and see where that lands me.


@pez the original talk is probably the most informative one:

❤️ 6

The audio gets better after the first 10 seconds


I really loved Tim's transducer explanations. That's when it all clicked for me.

metal 3

I’ll need to decide what I need the most. Getting transducers to click for me or the money. 😃


Doesn't he have a free one where he explains the functions


Not sure which functions? I found a fee one where he starts to talk about transducers, but the rest of that series is not free.


I mostly just use transducers where I would have used ->>


Ah, that's interesting! And very helpful for me. Thanks!


yeah, most of the talks early on just confused me as they talked a lot about the internals of transducers, whereas what I needed to know was that they were faster, created less garbage, and could replace most of my ->>

Ben Hammond10:10:11

I always worry that there is a lurking problem with eductions

(deftype Eduction [xform coll]
in that Iterable is supposed to give you an infinite number of usable Iterator objects, but IReduceInit does not provide that kind of implication; it might just be a one-shot thing

Ben Hammond10:10:53

I've see eductions used where you pass in a reducible as the coll, but then other parts see the Iterable interface flaunted by the eduction, try to use it as a sequential, and wonder why it oges horribly wrong


@ben.hammond What's the catch? eductions can behave as iterable objects, but also as efficiently reducible objects.

Ben Hammond10:10:11

(clojure.lang.TransformerIterator/create xform (clojure.lang.RT/iter coll))
might blow up if coll is just an IReduceInit but not a sequential

Ben Hammond10:10:45

creates a little unexploded Exception to be passed around


good point. what's an example of a coll that's not a sequential, but does satisfy IReduceInit?

Ben Hammond10:10:31

well anything that you created using

(reify IReduceInit
for example

Ben Hammond10:10:31

but I'm conflating two seperate issue here • Don't create eduction with colls that do not support Iterable is not the same as • How do you distinguish IReduceInits that are reusable from those that are one-shot


reify does support implementing multiple protocols/interfaces, but I guess you could forget to implement both

Ben Hammond10:10:55

I worked on a project where we had a Cognitect consultant who did exactly this; it creates an issue because when their Clojure-fu so far outstrips the team's it takes quite a while to figure out the problem


I guess you could also implement your own type on top of IReduceInit: (deftype OneShot [xforms coll] IreduceInit ...) which you can then feed to (into [] (OneShot. ...))

Ben Hammond10:10:34

and you could similiarly create (deftype EductionReduceOnly

Ben Hammond10:10:59

problem comes in when the logging framework • sees the Sequential on the eduction tries to use it to write a log string an blows up your server OR • correctly uses the one-shot IReduceInit, but thus exhausts the reducible so its not available to do the real work (for example, all sorts of insidious problems can arise from this)


good moaning

🗿 3
Ben Hammond11:10:23

there seems to be missing an emoji for > moan is 😩 the closest we can get?

Ben Hammond11:10:29

which (interestingly) looks like a USB-C plug

🤯 6

Maybe a picture of an English man pretending to be a French police officer?


Ha! I've now rewritten a few transduce examples to ->> . A bit backward, you might think, but it seems to help me figure out how to use transduce. Thanks @otfrom!


I think I probably use into more than transduce, but I usually just want to do something horrible to a seq and have it turn into a vector


Yeah, while I do want to have transduce in my tool chest, the most important thing to me right now is to be able to read more Clojure code.


I do find that into and transduce help me to create and read more clojure code. It makes it easy to create composable transformation pipelines

👍 6