On Apr 26, 2020, at 13:10, Derek Fawcus wrote:
I guess I'd have to question why someone would wish to write such a construct,
as error handling seems awkward.
FWIW, I do most of my programming these days in Elixir. It's a functional
programming language with pervasive pattern matching, Rubyish syntax, and
Lispish macros. It runs on the Erlang virtual machine, so it has a good
story for Actor-based concurrency, distribution, etc. For details, see:
https://en.wikipedia.org/wiki/Elixir_(programming_language)
Anyway, compilation is mostly handled by Lispish macros, so it can support
some fairly cool metaprogramming. In particular, I can write things like:
out_map = inp_list |>
Enum.filter(filter_fn) |>
Enum.map(map_fn) |>
Enum.reduce(%{}, reduce_fn)
Piped values are handed in as the first argument to each function and most
functions expect this behavior. For extra credit, there is a set of Stream
functions (really, macros) that process one element at a time and handle
errors in a reasonable manner.
-r