I’m more interested in having data structures without behaviour.
Which is what structs gives you.
Steve Klabnik wrote an informative article on ruby’s structs years ago that I still refer to occasionally.
Chains of functions are pipelines. That’s exactly why it’s part of the elixir syntax.
Wouldn’t it have to be part of any functional language syntax?
Nope. Typically you’ll see:
odd? = &(rem(&1, 2) != 0)
Enum.sum(Enum.filter(Enum.map(1..100_000, &(&1 * 3)), odd?))
With elixir’s pipes, that can be rewritten:
|> Enum.map(&(&1 * 3))
Mutations are always time-ordered, not all ‘things’.
They’re not. Unless you think sequentially.
I think I get laziness though I haven’t proved that yet.
As simple as (from above):
|> Stream.map(&(&1 * 3))
That’s where my interest comes from. I’m trying to unbundle the pieces that are considered components of OOP and FP, to see what can be removed or mixed and matched, to gain a better understanding of computation. The Lisp I knew had mutable values, so that clearly wasn’t an essential on the journey but I think it is needed for safe concurrency.
I think I’ve mentioned this before, but ruby is a lovely language to explore both OO and (elements of) FP. A lot of techniques can be interchanged.
I do think you’re missing an opportunity, though, with you adherence to clojure. José is very much experimenting with elixir in FPland, and given his strong ruby background, bringing across many of OO’s successful elements. If you want to learn, then I can’t think of a better language to explore computation at this time.