User defined pipe and redirection operators: Difference between revisions
User defined pipe and redirection operators (view source)
Revision as of 14:24, 16 September 2011
, 12 years ago→{{header|J}}
Line 56:
As for the concept of a pipe that presents data one record at a time to a downstream function, that corresponds to the J operator <code>@</code> but it's not clear how to demonstrate that usefully, in this task. (And, I could write pages of code, to accomplish what's being accomplished here with the two successive greps, but I find that concept distasteful and tedious.)
That said, note also that J's sort (<code>/:~</code>) and uniq (<code>~.</code>) operations would work just fine on this kind of data. For example:
<lang j> ;'aa' grep 'ALGOL' grep data,data
* Adriaan van Wijngaarden - Dutch pioneer; ARRA, ALGOL
* Adriaan van Wijngaarden - Dutch pioneer; ARRA, ALGOL
;~.'aa' grep 'ALGOL' grep data,data
* Adriaan van Wijngaarden - Dutch pioneer; ARRA, ALGOL
</lang>
=={{header|Perl}}==
|