To gain a better understanding of how FRP might be implemented, I wrote a simple FRP library.
Wrapping a function in a ‘def-macro’ is a common Clojure pattern. This practice serves two purposes: providing a nicer syntax for definitions, and controlling evaluation order. Although simple to understand, this pattern is somewhat repetitive. Introducing: a higher-order macro that relieves this pain.
Complicated reduce algorithms are still tricky for me sometimes. Clojure’s for makes map more visual, which makes it easier for me to engage my imagination. Racket extends this idea to reduce with for/fold, and also supports reducing multiple collections. Let’s port it over to Clojure.
Inspired by the ideas of Datascript and GraphQL, and frustrated by the boilerplate common in implementing API’s, I set out to explore a possible solution.
Last saturday I attended DCD ’17. Here’s what I took away from it.
Multimethods are one of Clojure’s primary polymorphism mechanisms. They allow dispatch on an arbitrary number of arguments, by combining a dispatching function with one or more methods. Here’s a way to implement them.
After reading Alexis King’s post about ADT’s in Typed Racket, I felt inspired to try the same thing in Clojure.