[Haskell-cafe] Splitting Hairs Over Terminology
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Mon Feb 26 23:08:53 EST 2007
On Feb 26, 2007, at 22:17 , P. R. Stanley wrote:
> Prelude> 13:[1, 2]
> [13, 1, 2]
> which I don't believe has an address in the memory, correct?
If I understand what you're getting at: internally it just allocates
a new cons cell, stuffs 13 in the left side and a pointer to the
existing list [1, 2] in the right side, yes.
> Back to the comma, surely, syntax sugar fulfills the role of an
> operator, a function, or a sequence of low-level procedures, either
> in part or comprehensively.
I suppose I'd have to go with the latter. In the formal constructor
syntax (,,) it's just part of the operator name, but the tuple
constructors are unique in that they don't need to be predeclared ---
Haskell just looks for a parenthesized series of commas and counts
the commas to find out the size of the tuple. (Note that the unit
type () falls out of this as a degenerate case.) (1, 2, 3) is
internally rewritten to (,,) 1 2 3, then parsed as the tuple
constructor (,,) applied to the three arguments that constructor
Prelude> :kind (,,)
(,,) :: * -> * -> * -> *
Prelude> :type (,,)
(,,) :: a -> b -> c -> (a, b, c)
My point is that, syntactically, the comma can't really be considered
a function or an operator per se; it's just special syntax.
brandon s. allbery [linux,solaris,freebsd,perl] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
More information about the Haskell-Cafe