Re: [svn:perl6-synopsis] r14415 - doc/trunk/design/syn larry@cvs.perl.org wrote: > Author: larry > Date: Sun Jun  3 17:23:15 2007 > New Revision: 14415 > > Modified: >    doc/trunk/design/syn/S03.pod >    doc/trunk/design/syn/S04.pod >    doc/trunk/design/syn/S06.pod > > Log: > typo from Aaron Crane++ > s/cat/list/ for flattening captures in order > cat() now only produces pseudo-strings even in list context > Modified: doc/trunk/design/syn/S03.pod > ============================================================================== > --- doc/trunk/design/syn/S03.pod        (original) > +++ doc/trunk/design/syn/S03.pod        Sun Jun  3 17:23:15 2007 > @@ -610,7 +610,7 @@ >      $string x $count > >  Evaluates the left argument in string context, replicates the resulting > -string value the number of time specified by the right argument and > +string value the number of times specified by the right argument and >  returns the result as a single concatenated string regardless of context. > >  If the count is less than 1, returns the null string. > @@ -625,7 +625,7 @@ >      @list xx $count > >  Evaluates the left argument in list context, replicates the resulting > -C value the number of time specified by the right argument and > +C value the number of times specified by the right argument and >  returns the result in a context dependent fashion.  If the operator >  is being evaluated in ordinary list context, the operator returns a >  flattened list.  In slice (C<@@>) context, the operator converts each C > @@ -3554,15 +3554,12 @@ >          ... >      } > > -To read arrays serially rather than in parallel, use C. > -This wins a "useless use of cat award" in this case since you could > +To read arrays serially rather than in parallel, use C. > +This wins a "useless use of list award" in this case since you could >  always just write C<(@x,@y)> to mean the same thing.  But sometimes >  it's nice to be explicit about that: > > -    @foo := [[1,2,3],[4,5,6]]; say cat([;] @foo); # 1,2,3,4,5,6 > - > -(The C function is not entirely useless; it also provides stringy > -semantics in string context.) > +    @foo := [[1,2,3],[4,5,6]]; say list([;] @foo); # 1,2,3,4,5,6 Let me see if I understand this correctly: * In list context, a list of captures gets flattened. * In slice context (a variant of list context), a list of captures doesn't get flattened. * In hash context (another variant of list context), a list of captures gets flattened, and then grouped into Pairs. * In item context, a list of captures becomes a single Array object, and the question about whether or not it gets flattened gets deferred until its contents get looked at in list, slice, or hash context. Meanwhile, 'zip' produces a list of captures - which, because list context is the default "plural" context, immediately gets flattened most of the time.  As I see it, then, the serial equivalent to 'zip(@a;@b)' would be '(@a;@b)', and 'list(@a;@b)' would be the serial equivalent to 'list(zip(@a;@b))'. Or does '(@a;@b)' default to slice context? --  Jonathan "Dataweaver" Lang