Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The full quote.

    The one-sided pattern matching seems to be a     peculiarity of Elixir. The post above discusses an     implementation of full unification without that     restriction. To clarify, unification is not     generally restricted to one-sided matching only.
I'm saying that, except for Erlang, the languages mentioned (Haskell, OCaml, F#, etc.) don't support one-sided pattern matching like Elixir does.

Elixir's pattern matching is more like unification. For example:

    [a, a, b, a] = [1, 1, 2, 1]
This kind of pattern matching, where a variable can appear multiple times on the left-hand side and must match the corresponding parts of the list, can't be done easily in Haskell or OCaml. In those languages, each variable can only appear once on the left side of a pattern match.

the OP is saying that this style of one sided pattern matching is indeed a peculiarity of Elixir (and Erlang)



I see, that's indeed an important distinction. Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: