--- Jonathan Scott Duff <[EMAIL PROTECTED]> wrote: > On Wed, Jan 08, 2003 at 05:14:06PM +0100, frederic fabbro wrote: > > I'm not even sure how that would parse, though that: > > @keep <~ grep /good/ <~ @list ~> grep /bad!/ ~> @throw; > > would go like: > > ( @keep <~ grep /good/ <~ @list ) ~> grep /bad!/ ~> @throw; > > > > which is probably not what i wanted... > > Oh, then we just need a syntax to split the streams. ... I know! > > @list ~| grep /bad!/ ~> @throw ~| grep /good/ ~> @keep; > > which, of course, could be written in the more readable form: > > @list ~| grep /bad!/ ~> @throw > ~| grep /good/ ~> @keep; > > And that, of course, leads us to sort of "unzip" were mutual > exclusion > is not a requisite: > > @list ~| grep length == 1 ~> @onecharthings > ~| grep [0..29] ~> @numberslessthan30 > ~| grep /^\w+$/ ~> @words > ~| grep $_%2==0 ~> @evennumbers; > > :-)
Smiley aside, this is brilliant. It is nicely high-level (allowing for parallelization/optimization behind the scenes), it reads nicely, and it works as a high-leverage idiom. I can see this as a nice basis for built-in threading below the level of developer control. Also, it enables the "two dimensional coding" that Damian likes. And it doesn't have to be an array op. It could be a continuation op: -$b |~> + sqrt($b ** 2 - 4*$a*$c) ~> $n1; |~> - sqrt($b ** 2 - 4*$a*$c) ~> $n2; (Yes, I know this would be a primo spot for a junction, but that's off topic.) So |~> does ~> except it remembers the LHS of the last invocation, if one isn't provided (NOT the last ~>, but the last |~>). Likewise <~| I guess, but what does it remember? It could remember the object: my WshObject $obj = $app.CreateObject($browser, $pfx); MenuBar 0 <~| $obj; ToolBar 0 <~|; AddressBar 0 <~|; Height 600 <~|; Width 500 <~|; Visible 0 <~|; Or it could remember the method: my ($a, $b, $c, $d) = get_some_objects(); MethodCall $arg1, $arg2, $exp - $re + $ssion <~| $a; <~| $b; <~| $c; <~| $d; Shiny! is right. =Austin