FPOO Ch. 9: Functions That Make Functions
[boilerplate bypath=”fp-oo”] Unlike Clojure, as far as I know Elixir does not have a library of foundational higher-order functions such as like lift or complement. So I’ll have to build…
[boilerplate bypath=”fp-oo”] Unlike Clojure, as far as I know Elixir does not have a library of foundational higher-order functions such as like lift or complement. So I’ll have to build…
[boilerplate bypath=”fp-oo”] This is where FPOO starts to get interesting. I have to say I find the choice of the term “dataflow” confusing due to its other associations in programming….
Continuing to translate the code from Brian Marick’s “Functional Programming for the Object Oriented Programmer” into Elixir.
[boilerplate bypath=”fp-oo”] So far, my tiny object system in Elixir has been stowing all methods directly in instances. Chapter 5 of FPOO directs me to move instance methods out into…
[boilerplate bypath=”fp-oo”] Today I slightly refine the nascent OO implementation in Elixir. Here’s the new point constructor, with methods contained within it: def new_point(x, y) do [ x: x, y:…
[boilerplate bypath=”fp-oo”] I feel like I should start with a disclaimer: this post is not advocating building an OO system on top of an FP language. And anyway, the Elixir/Erlang…
[boilerplate bypath=”fp-oo”] Exercise 3: add-squares First up, we have add-squares . Let’s write a test… test “1.18-3: add-squares” do assert(add_squares([1, 2, 5]) == 30) end My Elixir version takes a…
[boilerplate bypath=”fp-oo”] Elixir already has a perfectly good apply . But FPOO suggests I try to write my own version, and why not? def my_apply(func, sequence) do code = quote…