Matching elements of records
Thu Oct 28 03:41:54 CEST 2004
Richard A. O'Keefe wrote:
> I note that in the other functional programming languages I use,
> *only* the
> <variable> = <pattern>
> <variable> @ <pattern>
> <variable> as <pattern>
> form is available, not the "reversed" form with the variable on the right.
> I would find the "reversed" form rather confusing and unpleasant to read.
The general case (supported by several languages including Oz and E, for
<pattern1> = <pattern2>
which is handled by attempting to unify (in the constraint logic
programming sense) <pattern1> with <pattern2>, where either or both
can contain variables. This is equivalent to
<pattern2> = <pattern1>
and so it makes no sense to disallow the "reversed" special case.
David Hopwood <david.nospam.hopwood@REDACTED>
More information about the erlang-questions