clever, I had to stare at it for a few minutes to go through all the possibilities.
That's where the real beauty of a neatly syntaxed pattern matching expression could do a great deal to make it super obvious, what one wants to express with their code.
Sometimes the stars align and you get to "fake it" with a Bitwise OR (|):
clever, I had to stare at it for a few minutes to go through all the possibilities.
That's where the real beauty of a neatly syntaxed pattern matching expression could do a great deal to make it super obvious, what one wants to express with their code.
That's possibly because of lack of familiarity.
The Rust equivalent doesn't look that different to me:
in particular
In Erlang (and Elixir is similar) something like (again, assuming that the sides are sorted by length so that equal sides will always be adjacent)
or
ReScript (aka ReasonML; JavaScript flavored OCaml)
etc.
very likely.
And nice overview, of how different languages handle the same problem