Anonymous user
User defined pipe and redirection operators: Difference between revisions
User defined pipe and redirection operators (view source)
Revision as of 01:53, 28 April 2013
, 11 years ago→{{header|ALGOL 68}}: PROC and OP details
(→[[User_defined_pipe_and_redirection_operators#ALGOL68]]: fix wikilinks) |
(→{{header|ALGOL 68}}: PROC and OP details) |
||
Line 110:
>> = (GENLINE gen, PAGEAPPEND page)VOID: gen(APPEND page),
=: = (GENLINE gen, FILTER filter)GENLINE: filter(gen),
=: = (GENLINE gen, MANYTOONE cmd)GENLINE: cmd(gen);</lang>
* See [[User defined pipe and redirection operators/ALGOL 68#Iterator_pipe_utilities]]▼
'''File: Iterator_pipe_utilities.a68'''
*
<lang algol68> # Sample ''utilities'' PROCedure declarations #
PROC cat = ([]GENLINE argv)GENLINE:~;
PROC tee = ([]YIELDLINE args filter)FILTER:~;
PROC grep = (STRING pattern, []GENLINE argv)GENLINE:~;
PROC uniq = (GENLINE arg)GENLINE:~;
PROC sort = (GENLINE arg)GENLINE:~;
PROC head = (INT n, []GENLINE args)GENLINE:~;
PROC tail = (INT n, []GENLINE args)GENLINE:~;</lang>
'''File: Iterator_pipe_page.a68'''
▲*
<lang algol68># Sample ''pipe I/O'' OPerator declarations #
OP READ = (PAGEIN page)GENLINE:~;
OP WRITE = (PAGEOUT page)YIELDLINE: ~;
OP APPEND = (PAGEAPPEND page)YIELDLINE:~;</lang>
'''File: test_Iterator_pipe_page.a68'''
<lang algol68>#!/usr/local/bin/a68g --script #
# First define what kind of record (aka LINE) we are piping and filtering #
|