FPOO Chapter 5: Classes

[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…

Read More

FPOO Chapter 4: Encapsulating methods in the constructor

[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:

And here’s send_to, which (slightly) eases sending…

Read More

FPOO Chapter 1 in Elixir

[boilerplate bypath=”fp-oo”] Exercise 3: add-squares First up, we have add-squares . Let’s write a test…

My Elixir version takes a list rather than a variable number of arguments, because…

Read More

Re-implementing apply in Elixir

[boilerplate bypath=”fp-oo”] Elixir already has a perfectly good apply . But FPOO suggests I try to write my own version, and why not?

This is considerably more verbose than…

Read More