Equals is an Assertion, not an Assignment
Understanding assignment in pattern-matching functional languages.
Understanding assignment in pattern-matching functional languages.
[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….
[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…
I just installed Elixir and there were one or two non-obvious points. Elixir requires Erlang OTP 16, and the Ubuntu package repos contain release 15. So the Ubuntu Erlang packages…