On (09/12/02 06:00), Stéphane Payrard wrote:
> Date: Mon, 9 Dec 2002 06:00:40 +0100
> From: Stéphane Payrard <[EMAIL PROTECTED]>
> To: Damian Conway <[EMAIL PROTECTED]>
> Cc: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> Subject: right-to-left pipelines
> 
> 
> I would like perl6 to support left-to-right part/sort/grep pipelines.
> Left to right syntax is generally good because it facilitates the flow
> of reading.
> 
> For these pipelines, the current right to left syntax is due to the emphasis
> on the operation over the data operated on, so the operator appears
> first. Nevertheless with a long pipeline, data is best factored out in a
> variable so having it first is not an impediment.
> 
> Tentative syntax:
>   ... is an left-associative operator that has the same precedence as .
> 
>   argexpr...listop indirop
> 
>     would be equivalent to
> 
>   listop indirop  argexpr


I am wrong about the precedence, the operator should just looser than
list operator and certainly looser than comma to avoid to use
parentheses around argexpr

    (argexpr)...listop indirop #  parenthese necessary if ... too tight

>     
> 
> example:
> 
> @data = [ very_long_data_expression ]
> (@foo, @bar) := @data...grep { $_ > 0 }...sort { $^b <=> $^a }...part [/foo/, /bar/];
> 

To go left to right all the way, we could have:

  @data...grep { $_ >0   } ...sort...@result

Or even

  @data...grep { $_ >0   } [EMAIL PROTECTED]@result2 ... grep { % 2}... @result3;



--
  stef

Reply via email to