Re: Re: Varför kan jag inte inte anropa A -- B -- C ?
Richard A. O'Keefe
ok@REDACTED
Mon Oct 20 01:13:03 CEST 2003
The question has been asked, "why is X++Y++Z read as X++(Y++Z)?"
>From the Haskell standard Prelude:
infixr 5 ++
>From SML:
infix5 :: @
(* :: is infix cons, @ is the same as Erlang ++ *)
While "append" is associative, "cons" is not; the only fixity for
infix cons which makes any sense at all is 'infixr'; the semantics
of append being so intimately related to the semantics of cons, and
the 'infixr' fixity for append naturally leading to the efficient
evaluation order without any subterfuge, it makes sense for "append"
to be infixr as well.
Indeed, it would be quite perverse for a functional programming language
with Lisp-style lists to make infix append left associative.
Simplicity is all very well, but sanity must take first place.
More information about the erlang-questions
mailing list