Author: larry Date: Wed Feb 21 09:25:37 2007 New Revision: 13699 Modified: doc/trunk/design/syn/S03.pod
Log: ¥ is replaced by Z. XX becomes simply X and old X must now be spelled X~X. Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Wed Feb 21 09:25:37 2007 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 8 Feb 2007 + Last Modified: 21 Feb 2007 Number: 3 - Version: 100 + Version: 101 =head1 Overview @@ -46,7 +46,7 @@ Item assignment = := ::= => += -= **= xx= .= Loose unary true not Comma operator , - List infix ¥ minmax X XX X~X X*X XeqvX + List infix Z minmax X X~X X*X XeqvX List prefix = : print push say die map substr ... [+] [*] any all Loose and and Loose or or xor err @@ -1069,13 +1069,13 @@ =item * -infix:<¥>, the zip operator +infix:<Z>, the zip operator - 1,2 ¥ 3,4 # (1,3),(2,4) + 1,2 Z 3,4 # (1,3),(2,4) =item * -The minmax operator +infix:<minmax>, the minmax operator $min0, $max0 minmax $min1, $max1 # ($min0 min $min1, $max0 max $max1) @@ -1094,30 +1094,19 @@ =item * -List and string cross operators +infix:<X>, the cross operator - 1,2 XX 3,4 # (1,3), (1,4), (2,3), (2,4) - 1,2 X 3,4 # '13', '14', '23', '24' + 1,2 X 3,4 # (1,3), (1,4), (2,3), (2,4) -In contrast to the zip operator, the C<XX> operator returns all the +In contrast to the zip operator, the C<X> operator returns all the permutations of its sublists. Hence you may say: - <a b> XX <1 2> + <a b> X <1 2> and you end up with ('a', '1'), ('a', '2'), ('b', '1'), ('b', '2') -The C<X> variant crosses the arrays but concatenates strings: - - <a b> X <1 2> - -produces - - 'a1', 'a2', 'b1', 'b2' - -The resemblance to C<x> and C<xx> is not entirely accidental. - =item * Cross hyperoperators @@ -1234,14 +1223,14 @@ precedence on the right sufficiently to govern list infix operators: - $: 1,2 ¥ 3,4 # [[1,3],[2,4]] - @: 1,2 ¥ 3,4 # 1,3,2,4 - @@: 1,2 ¥ 3,4 # [1,3],[2,4] - %: 1,2 ¥ 3,4 # { 1 => 3, 2 => 4 } - - $: 1,2 XX 3,4 # [[1,3],[1,4],[2,3],[2,4]] - @: 1,2 XX 3,4 # 1,3,1,4,2,3,2,4 - @@: 1,2 XX 3,4 # [1,3],[1,4],[2,3],[2,4] + $: 1,2 Z 3,4 # [[1,3],[2,4]] + @: 1,2 Z 3,4 # 1,3,2,4 + @@: 1,2 Z 3,4 # [1,3],[2,4] + %: 1,2 Z 3,4 # { 1 => 3, 2 => 4 } + + $: 1,2 X 3,4 # [[1,3],[1,4],[2,3],[2,4]] + @: 1,2 X 3,4 # 1,3,1,4,2,3,2,4 + @@: 1,2 X 3,4 # [1,3],[1,4],[2,3],[2,4] These can also influence the result of functions that returns lists of captures: @@ -2892,7 +2881,7 @@ [//]() # undef [=]() # undef (same for all assignment operators) [,]() # [] - [¥]() # [] + [Z]() # [] User-defined operators may define their own identity values, but there is no explicit identity property. The value is implicit in the @@ -2998,17 +2987,17 @@ produces - ['a', 1, 'x'], - ['a', 1, 'y'], - ['a', 2, 'x'], - ['a', 2, 'y'], - ['b', 1, 'x'], - ['b', 1, 'y'], - ['b', 2, 'x'], - ['b', 2, 'y'] + ('a', 1, 'x'), + ('a', 1, 'y'), + ('a', 2, 'x'), + ('a', 2, 'y'), + ('b', 1, 'x'), + ('b', 1, 'y'), + ('b', 2, 'x'), + ('b', 2, 'y') -The string and list forms are common enough to have shortcuts, C<X> -and C<XX> respectively. See below. +The list form is common enough to have a shortcut, C<X>. +See below. For the general form, any existing, non-mutating infix operator may be used. @@ -3280,8 +3269,7 @@ print "Name: $name; Zip code: $zip\n"; } -C<zip> has an infix synonym, the Unicode operator C<¥>, and its ASCII -equivalent C<Y>. +C<zip> has an infix synonym, the C<Z> operator. To read arrays in parallel like C<zip> but just sequence the values rather than generating tuples, use C<each> instead of C<zip>.