Would transducers be an interesting subject for a podcast?
great! thanks & looking forward to it!!
practical use cases of transducers would be something I would be interested in
ā¦ because I built some simple toy transducers, and informally testing them with (time (ā¦)) didnāt show an advantage over functions - but I guess, this view on the matter ist too narrow
Thanks for the ongoing series āReduce! Reduce! Reduce!ā š
āReduce! Reduce! Reduce!ā Thatās great! š
Youāre welcome! And yes, weāre trying to keep it practical.
(and I really appreciate the mixture of humor and knowledge in the podcast!)
Thanks! We love the banter too!
Part of the challenge of keeping it practical is that reducers and transducers are a bit niche.
They have certain performance benefits in certain cases.
And composability?
and, with transducers specifically, you can use them for Clojure core stuff with really having to know (or care) how they work.
Right. They are motivated by performance, but must be composible by necessity.
ah, so performance is the main motivation
So composition is a big deal, but the whole point of both of them is to separate out the computation from the underlying representation of the collection.
I see
1. You wonāt have intermediate lists 2. You cans parallelize (in some cases)
But to get there, you have to be able to build up the transform.
Yes, just learning how now (endless REPLing š
So they have to be composible to allow you to do that.
Another question is, if the benefits are the same in clojurescript
Hurray for REPLing!
[REPLing all the time]
Reducing functions are useful in general. The reducers library doesnāt work in Clojurescript because it needs Javaās fork-join stuff.
Transducers work everywhere.
(Yes, I meant transducers specifically)
I havenāt personally done a lot of benchmarking, but the bigger the transform (having a lot of steps), the faster it should run vs the equivalent thread macro version using sequences.
On both platforms.
because the intermediary colls are not needed/created, right?
Right. It avoids those intermediate collections.
I suppose itās worth saying that transducers are a great fit if you have some problem domain where you have to assemble different transforms before processing a seq.
I havenāt hit a concrete example of needing transducers yet, but Iām always looking for one.
Using them with core.async channels is a great example, though.
@nate (so this conversation shows up in your threads)
Iām just working on a musical subject, where transformations are a major thing (this was the main motivation to try a LISP, because it seems so very appropriate, and that lead - happyily - to Clojure)
(core.async is another thing to learn, yes)
Yes. We need to cover core.async too. We use it constantly.
What music thing are you doing?
Iām a teacher for music theory in Viennaās University for Music and Performing Arts
and I try to build learning tools
after āReducers!ā I will come back with questions on XML, because of this one: https://music-encoding.org
How neat! Itās a pleasure to meet you!
That initiative looks interesting too.
Yes, it is, and there is a companion project:
I donāt know if Iād call processing XML ādelightfulā, but I think itās about as delightful as possible in Clojure.
Oh, that is seriously cool.
Rendering out scores.
Itās the first usable music notation engine for the web; it understands music in the form of MEI XML
Nifty!
so this is the motivation (before I had tried to program such a thing with ClojureScript and SVG, but then found this engine
Ah, OK.
Now Iām super curious. Iāll check them out later.
Itās been a pleasure chatting this morning! Iāve got to run, but feel free to post here or in the main channel. Iāll be back later.
Great - thanks for the chat!
Apologies for the late reply, but I'd love to help build an MEI parser because that would be super useful
Sounds great! Being curious: are you working on a similar project?
Yes I thought it was pretty funny because I'm also building music training tools, but am still at the stage of attempting to write my own SVG rendering engine.
Oh wow.
ah! thatās what I tried a couple of months ago!
(some things did work already)
@porkostomus maybe we should look at both options: parsing and using MEI/Verovio and thinking about āMusic-SVGā
Sounds like a good idea. I set up a repo with a little starter app: https://github.com/porkostomus/mecca-mei Bonus: it uses transducers! I followed this article, and only had to change it to work in cljs: https://juxt.pro/blog/posts/xpath-in-transducers.html
wow! that was fast ā¦ š
YES! I'm having some trouble getting the concepts around this
me too ā¦ so: moderators? š
yes, yes they would be an interesting subject for an episode or three
š
We're starting our journey in that direction starting with the episode we're about to release today!