R H
23 Nov 2021
•
1 min read
When I first stumbled across Elixir I was thrilled to discover the syntax was almost identical to that of the Ruby language. The power of Erlang available through a Ruby-like syntax. "What a find!", I thought.
To learn Elixir basics I dreamt up a trivial study project based around the beautiful simplicity of functions that always return one of two things, {:ok, result}
or {:error, reason}
.
The scene was set!
If our functions only return two types of tuple it makes it easy for us to chain them together:
One.func(45, "a string", 3.142)
|> Two.func("foobar")
|> Three.func()
Function Two.func/2
knows exactly what to expect from One.func/3
; function Three.func/1
knows exactly what to expect from Two.func/2
. Great!
But then I said, let's make all functions look the same (argument-wise) and call them 'modifiers' (after all, that's what they are!)
ModifyChain provides the scaffolding that allows you to flexibly 'run' a 'chain' of standard, built-in modifiers and makes it easy to mix and blend them with ones you create yourself.
So the idea is that you can build anything, on the fly, by chaining together modifiers in different ways -- just like building a Lego model!
A super simple project to get my feet wet with Elixir and the creation, inadvertently, of a new, fun, easily extensible, scripting language -- ModifyChain Script!
Ground Floor, Verse Building, 18 Brunswick Place, London, N1 6DZ
108 E 16th Street, New York, NY 10003
Join over 111,000 others and get access to exclusive content, job opportunities and more!