--- attriel <[EMAIL PROTECTED]> 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... > > I would, from the descriptions, imagine that: > @keep <~ grep /good/ <~ @list ~> grep /bad!/ ~> @throw; > > Would parse as: > @keep <~ grep /good/ <~ @list; > @list ~> grep /bad!/ ~> @throw;
Actually, if you can say "@a ~> sort ~> grep /foo/ ~> @output" then it's pretty obvious that ~> is left-associative, a la << in C++. Remember: cout << "Hello, world!" << nl; First does cout<<"HW" and returns cout-prime, then does cout-prime << nl Likewise, the perl example does @a ~> sort, returning @a-prime @a-prime ~> grep /foo/, returning @a-2prime @a-2prime ~> @output, returning @output-prime, I hope! Reversing the direction: @output <~ grep /foo/ <~ sort <~ @a First does sort :@a, (I hope the syntax is right) returning @a-prime then does grep /foo/ :@a-prime, returning @a-2prime then does @output.operator() :@a-2prime which we hope gets transmogrified into assignment, and I likewise hope this will return @output-prime. So <~ looks right-associative. > > @keep <~ grep /good/ <~ @list ~> grep /bad!/ ~> @throw; Assuming that <~ and ~> have equal precedence, and that there's not some hideous special case backing this syntax, the above becomes: 1: @list ~> grep /bad!/ 2: ~> @throw 3: grep /good/ <~ 4: @keep <~ Which greps the @throw list for goodies -- not what I think you want. > @keep <~ grep /good/ <~ @list; > @list ~> grep /bad!/ ~> @throw; > Due to that being what is almost always going to be intended, I > think. Which brings up the point: What DO we want here? Frankly, I'm in love with the idea of a simple pipeline operator. I find it really easy to write AND read scripts like this: cat file | sed -e ... | grep -v ... | nl | sort -k ... | awk ... | sort > output Being able to "draw" the pipeline make it really readable for the maintainer. The idea of doing something similar: @a ~> grep ~> map ~> @output is attractive. Regardless, I'm sure I don't like $foo ~> print <~ STDOUT That one's going to die a lonely death. =Austin