A thread in a different channel spawned an idea, but I wanted to get some feedback before digging into it a little bit... the original thread sort of boiled down to "I have a collection-building loop in python that does imperative control flow (e.g. continue and maybe break), and I'm not too happy with my clojure port". Vamping in 🧵 ...
These loop control keywords are more widely applicable than python, and it feels like a concept that's easy to trip over, so I was thinking about a small cookbook(?) page that would demonstrate some parallels. I don't think clojure-doc currently has any "here's a translation from language X to clojure" content, and the goal here would be more of a "concept translation" than a direct language-to-language conversion.
So, I'm looking for feedback on: • if it feels like a good/useful idea • if a cookbook on clojure-doc seems like a good fit • opinions on using python vs pseudocode/"blub" (or some other specific language) as a source
I think that would fit pretty well as a cookbook. There's just been a sort of related discussion on Discljord: specifically about recursion and loop/recur -- because beginners tend to glom onto "loops" because that's sort of familiar from other languages, rather than shifting to higher-order functions and collection-based operations.
I think showing other languages -- not just Python but maybe also Ruby and Java? -- is reasonable in that sort of cookbook, since it's showing "The Clojure Way(tm)" in contrast to "mainstream" languages.
My current iteration of the idea is to go source language -> loop/recur -> reduce (and with reduce, just call out map and filter as special cases that happen to be lazy)
Maybe a good opportunity to show how transduce can sometimes make things simpler too?
I'll keep transduce in mind and see how it plays out. I don't want to wander too far in one journey, but I'll see if I can make the transition smooth and go from there.