PurelyFunctional.tv Newsletter 350: Monoid pattern submissions
On Vacation 🏕
This is going to be a light issue this week. I'm on vacation at the moment. I'll miss next week's too!
Conference alert 🚨
I booked my tickets to the 2019 Clojure/conj in Durham, North Carolina this week. If you're going, let me know! I haven't been to a conj in a couple of years and I'm really excited.
I'm also planning on attending a local Elixir conference (The Big Elixir) if you happen to be going to that. In that case, give me a holler!
Currently recording 🎥
Clojure Challenge 🤔
Last week's challenge
The challenge in Issue 349 was to write a function to build monoid-pattern compliant functions.
You can check out the submissions here.
My favorites were the incredibly succinct from Ben Grabow:
(defn monoid [id fn-2] (fn [& args] (reduce fn-2 id args)))
and the incredibly clear and optimized from Teodor Heggelund:
(defn monoid [id fn-2] (fn ( id) ([x] x) ([x y] (fn-2 x y)) ([x y & more] (reduce fn-2 (fn-2 x y) more))))
No challenge this week.