I realized today that I can use anonymous functions to process “malformed” outputs inside pipes. For example:
def str_to_int!(str) when is_bitstring(str) do
str
|> Integer.parse()
|> (fn {res, ""} -> res end).()
end
My question is, is something like that good to use or does it make code harder to read? If you start using a lot of anonymous functions in that manner, you could turn most functions into one long pipe.