clojuredesign-podcast

Discussions around the Functional Design in Clojure podcast - https://clojuredesign.club/
mmeix 2019-12-06T19:42:25.130500Z

Would transducers be an interesting subject for a podcast?

2šŸ‘
mmeix 2019-12-07T13:02:45.132100Z

great! thanks & looking forward to it!!

mmeix 2019-12-07T13:36:38.132300Z

practical use cases of transducers would be something I would be interested in

mmeix 2019-12-08T16:11:55.132800Z

ā€¦ 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

mmeix 2019-12-08T16:12:50.133Z

Thanks for the ongoing series ā€œReduce! Reduce! Reduce!ā€ šŸ™‚

neumann 2019-12-08T16:15:12.134300Z

ā€œReduce! Reduce! Reduce!ā€ Thatā€™s great! šŸ™‚

neumann 2019-12-08T16:16:02.135200Z

Youā€™re welcome! And yes, weā€™re trying to keep it practical.

mmeix 2019-12-08T16:16:06.135500Z

(and I really appreciate the mixture of humor and knowledge in the podcast!)

neumann 2019-12-08T16:17:06.136500Z

Thanks! We love the banter too!

neumann 2019-12-08T16:17:41.137200Z

Part of the challenge of keeping it practical is that reducers and transducers are a bit niche.

neumann 2019-12-08T16:18:38.138400Z

They have certain performance benefits in certain cases.

mmeix 2019-12-08T16:18:57.138900Z

And composability?

neumann 2019-12-08T16:19:31.140100Z

and, with transducers specifically, you can use them for Clojure core stuff with really having to know (or care) how they work.

neumann 2019-12-08T16:20:21.141500Z

Right. They are motivated by performance, but must be composible by necessity.

mmeix 2019-12-08T16:20:59.142200Z

ah, so performance is the main motivation

neumann 2019-12-08T16:21:45.143500Z

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.

mmeix 2019-12-08T16:22:15.144300Z

I see

neumann 2019-12-08T16:22:29.144800Z

1. You wonā€™t have intermediate lists 2. You cans parallelize (in some cases)

neumann 2019-12-08T16:22:51.145600Z

But to get there, you have to be able to build up the transform.

mmeix 2019-12-08T16:23:21.146500Z

Yes, just learning how now (endless REPLing šŸ™‚

neumann 2019-12-08T16:23:22.146700Z

So they have to be composible to allow you to do that.

mmeix 2019-12-08T16:23:51.146900Z

Another question is, if the benefits are the same in clojurescript

neumann 2019-12-08T16:24:04.147500Z

Hurray for REPLing!

mmeix 2019-12-08T16:24:19.148Z

[REPLing all the time]

neumann 2019-12-08T16:25:29.149800Z

Reducing functions are useful in general. The reducers library doesnā€™t work in Clojurescript because it needs Javaā€™s fork-join stuff.

neumann 2019-12-08T16:25:37.150200Z

Transducers work everywhere.

mmeix 2019-12-08T16:25:58.150600Z

(Yes, I meant transducers specifically)

neumann 2019-12-08T16:27:17.152800Z

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.

neumann 2019-12-08T16:27:33.153200Z

On both platforms.

mmeix 2019-12-08T16:28:03.153800Z

because the intermediary colls are not needed/created, right?

neumann 2019-12-08T16:29:10.155300Z

Right. It avoids those intermediate collections.

neumann 2019-12-08T16:30:06.156900Z

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.

neumann 2019-12-08T16:30:37.158Z

I havenā€™t hit a concrete example of needing transducers yet, but Iā€™m always looking for one.

neumann 2019-12-08T16:31:11.158800Z

Using them with core.async channels is a great example, though.

neumann 2019-12-08T16:32:13.159800Z

@nate (so this conversation shows up in your threads)

mmeix 2019-12-08T16:33:00.160Z

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)

mmeix 2019-12-08T16:33:29.160200Z

(core.async is another thing to learn, yes)

neumann 2019-12-08T16:34:50.161Z

Yes. We need to cover core.async too. We use it constantly.

neumann 2019-12-08T16:35:08.161500Z

What music thing are you doing?

mmeix 2019-12-08T16:35:58.161700Z

Iā€™m a teacher for music theory in Viennaā€™s University for Music and Performing Arts

mmeix 2019-12-08T16:36:14.161900Z

and I try to build learning tools

mmeix 2019-12-08T16:36:27.162100Z

after ā€œReducers!ā€ I will come back with questions on XML, because of this one: https://music-encoding.org

neumann 2019-12-08T16:37:34.163Z

How neat! Itā€™s a pleasure to meet you!

neumann 2019-12-08T16:38:03.163500Z

That initiative looks interesting too.

mmeix 2019-12-08T16:38:23.164100Z

Yes, it is, and there is a companion project:

mmeix 2019-12-08T16:38:42.164900Z

https://www.verovio.org/index.xhtml

neumann 2019-12-08T16:38:48.165200Z

I donā€™t know if Iā€™d call processing XML ā€œdelightfulā€, but I think itā€™s about as delightful as possible in Clojure.

neumann 2019-12-08T16:39:26.165700Z

Oh, that is seriously cool.

neumann 2019-12-08T16:39:39.166200Z

Rendering out scores.

mmeix 2019-12-08T16:40:24.166400Z

Itā€™s the first usable music notation engine for the web; it understands music in the form of MEI XML

neumann 2019-12-08T16:40:47.166700Z

Nifty!

mmeix 2019-12-08T16:41:08.167300Z

so this is the motivation (before I had tried to program such a thing with ClojureScript and SVG, but then found this engine

neumann 2019-12-08T16:41:52.168100Z

Ah, OK.

neumann 2019-12-08T16:42:17.168800Z

Now Iā€™m super curious. Iā€™ll check them out later.

neumann 2019-12-08T16:42:48.169700Z

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.

mmeix 2019-12-08T16:43:14.169900Z

Great - thanks for the chat!

porkostomus 2019-12-14T09:14:24.000300Z

Apologies for the late reply, but I'd love to help build an MEI parser because that would be super useful

mmeix 2019-12-14T13:21:50.016700Z

Sounds great! Being curious: are you working on a similar project?

porkostomus 2019-12-15T03:15:34.037500Z

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.

nate 2019-12-15T03:47:28.040300Z

Oh wow.

mmeix 2019-12-15T16:42:55.041Z

ah! thatā€™s what I tried a couple of months ago!

mmeix 2019-12-15T16:43:57.041300Z

(some things did work already)

mmeix 2019-12-16T10:50:24.041600Z

@porkostomus maybe we should look at both options: parsing and using MEI/Verovio and thinking about ā€œMusic-SVGā€

porkostomus 2019-12-16T13:09:06.042Z

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

mmeix 2019-12-16T18:41:38.042500Z

wow! that was fast ā€¦ šŸ‘

sysarcher 2019-12-06T19:47:31.130800Z

YES! I'm having some trouble getting the concepts around this

mmeix 2019-12-06T19:48:02.131Z

me too ā€¦ so: moderators? šŸ™‚

nate 2019-12-06T20:52:49.131500Z

yes, yes they would be an interesting subject for an episode or three

nate 2019-12-06T21:24:31.131700Z

šŸ˜‰

neumann 2019-12-06T22:34:30.131900Z

We're starting our journey in that direction starting with the episode we're about to release today!