On 3/4/06, Chris Rathman <[EMAIL PROTECTED]> wrote:
> Spoke too soon - scratch that about ML.  That's not the way it works.
> X::Y only works if Y is a list.  You'd have to write 1::2::nil.  (1::2
> won't compile).
>
> Which leaves me with the question:  If 1|2 is not a list of [1 2], then
> what is it?

It's an "improper list," or something which has the recursive form of
a list but doesn't end in the right base case 2 | nil. However, [1 2]
is equivalent to 1 | [2].

You asked how to construct tuples: in Oz, a tuple is any record with
no explicitly-enumerated features. (Approximately.) So foo(1 2 3 4) is
a four-tuple, and so is bar(5 6 7 8) and qxy(a b c d). The '|'
operator constructs 2-tuples, and just assigns them the label '|'. So
1|2 is a 2-tuple '|'(1 2). If you want to construct bigger tuples,
either make up a label foo(a b c) or use the mixfix operator '#'. For
instance, 1#2#3 constructs a tuple '#'(1 2 3).

Max

--
Be pretty if you are,
Be witty if you can,
But be cheerful if it kills you.

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to