6 ms·
Sounds like a good old foldl may or may not have brightened up your day (with the "functional style" you mentioned) e.g. Pipeline = fun(Functions, Initial) -
by holsee 4y ago
Sounds like a good old foldl may or may not have brightened up your day (with the "functional style" you mentioned) e.g.
Pipeline = fun(Functions, Initial) ->
lists:foldl(
fun(Function, Acc) ->
Function(Acc)
end,
Initial,
Functions
),
Initial = SomeFunc(),
Pipeline = [Func0, Func1, Func2, Func3],
Result = Pipeline(Pipeline, Initial).
At a certain point I grew to not mind the punctuations `; , .`
I often miss language itself given how verbose things are in elixir by comparison.
The language ecosystem is pretty good with LFE for the Lispers https://lfe.io/ https://lfe.io/ and https://gleam.run/ https://gleam.run/ for the OCaml inclinded.
- weatherlight 4y agoseems more complicated than the following elixir code. Val |> SomeFunc() |> Func2() |> Func3()
- holsee 4y agoI agree, or a nice `with` clause. When strict simplicity is not the ultimately goal dare I say leaning into the monads is the way...