Rob,
On Saturday 10 May 2008 15:04, Rob Arthan wrote:
However it also allows brackets around the constructor:
val (op ::) (h, t) = [1, 2, 3, 4];
My reading of the syntax in the definition of Standard ML is that the latter form should not be allowed. Am I right?
I don't have a copy of the language definition on my desk (how about making that available on the Internet, by the way?), but the syntax charts in Paulson's "ML for the Working Programmer" (on page 417f.) allow the derivation
Pattern -> Atomic Pattern -> ( Pattern )
(if only to allow a tuple of patterns, e.g. "val (a, b) = ...").
On a side note, I noticed earlier that different SML implementations treat (op *) differently, as *) could also mark the end of a comment. I'm not sure what the standard says about this either.
Tjark