1#2#3 is a single tuple of three elements?

Raphael Collet raphael.collet at uclouvain.be
Wed Nov 21 14:04:01 CET 2007


The '#' operator is multifix: 1#2#3 is expanded to the tuple '#'(1 2 3). 
  To make it binary, you have to put parentheses...

	1#2#3 = '#'(1 2 3)
	(1#2)#3 = '#'('#'(1 2) 3)

It looks a bit weird at first, but it is very convenient!

Cheers,
raph

Terrence Brannon wrote:
> Re: http://www.mozart-oz.org/documentation/tutorial/node3.html#chapter.basics
> 
> I've been staring at this sentence for 10 minutes, trying to simply
> accept what it says, but it just does not make any sense to me:
> 
>    observe that 1#2#3 is a single tuple of three elements
> 
> But to my way of thinking, # is a binary operator and regardless of
> associativity, it first creates a 2-tuple of two values and then
> another 2-tuple nesting the first 2-tuple and the remaining element.
> 
> I really dont see how # could operate any other way, but would
> appreciate any feedback on how this is possible.
> _________________________________________________________________________________
> mozart-users mailing list                               mozart-users at mozart-oz.org
> http://www.mozart-oz.org/mailman/listinfo/mozart-users



More information about the mozart-users mailing list