On Mon, Feb 21, 2005 at 09:37:02PM -0600, Steve Peters wrote:
: On Mon, Feb 21, 2005 at 11:32:16AM -0800, Larry Wall wrote:
: > On Mon, Feb 21, 2005 at 02:07:10PM +0000, osfameron wrote:
: > : >    In Perl 6, C<< => >> is a fully-fledged anonymous object constructor 
--
: > : >    like C<[...]> and C<{...}>. The objects it constructs are called 
: > : >"pairs"
: > : >    and they consist of a key (the left operand of the C<< => >>), and a 
: > : >value
: > : >    (the right  operand). 
: > : 
: > : Can pairs also be used to create linked lists?
: > : 
: > :  my $x = 1=>2=>3=>4
: > : 
: > :  $x.key   = 1
: > :  $x.value = 2=>3=>4
: > 
: > Yep, certainly--as any Lisp programmer knows, pairs can be used to create
: > linked lists.  But we were hoping nobody would notice that.  :-)
: > 
: > In any event, we haven't optimized the pair notation to be the standard
: > list notation.  (But then, almost nobody actually uses dot notation
: > much in Lisp either...)
: > 
: > On the gripping hand, lists in Perl have historically been optimized
: > to be in contiguous memory rather than in linked lists, so standard
: > list notation in Perl is not based on pair semantics as it is in Lisp.
: > It would be possible to come up with a linked list notation for Perl 6
: > and install it via some kind of grammatical munge.  Bare S-expressions
: > won't work in standard Perl, of course, unless you make "(foo"
: > parse like some kind of reserved word for a known set of "foo".
: > I'm sure if you did that someone would consider it perverse.
: >
: 
: Just to clarify then, are the following two equivolent?
: my $x = 1 => 2 => 3 => 4;
: my $x = 1 => (2 => (3 => 4));

That seems right to me.  Or at least right associative.  :-)

In any event, right associativity seems more useful in this case.

Larry

Reply via email to