3 ms·
> The Elixir equivalent, likely a series of pipes, would be just as easy to follow but substantially more to read, more symbols to parse etc. Huh? [major, m
by asa400 1y ago
> The Elixir equivalent, likely a series of pipes, would be just as easy to follow but substantially more to read, more symbols to parse etc.
Huh?
[major, minor, patch] =
version_string
|> String.split(".")
|> Enum.map(&String.to_integer/1)
I don't know that I'd call this "substantially more" of anything.
- skrebbel 11mo agoEnum.map(&String.to_integer/1) vs .map(&:to_i) To me the latter is no less clear so yeah, substantially more. For context I write Elixir once a week and Ruby once a decade. In particular in this case elixir’s (and erlang’s) arity disambiguation (the slash) seems like unhelpful noise. Enum.map only accepts single-arity functions so it seems weird to me that the language couldn't figure that out for me.