top | item 40865637

(no title)

gergo_barany | 1 year ago

What is "the above"? The context was (https://news.ycombinator.com/item?id=40844208):

    > The one-sided pattern matching seems to be a peculiarity of Elixir.

    And Erlang. And Haskell. And OCaml. And F#. And...
All of these "languages mentioned above" have one-sided pattern matching. This was the claim. Not more, not less. Are you disagreeing with this claim? Are you trying to say something about "one-sided pattern matching"? Or are you trying to say something about something other than "one-sided pattern matching"? You are not being clear.

discuss

order

weatherlight|1 year ago

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)

gergo_barany|1 year ago

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