User defined pipe and redirection operators: Difference between revisions
Content added Content deleted
(→[[User_defined_pipe_and_redirection_operators#ALGOL68]]: fix wikilinks) |
(→{{header|ALGOL 68}}: PROC and OP details) |
||
Line 110: | Line 110: | ||
>> = (GENLINE gen, PAGEAPPEND page)VOID: gen(APPEND page), |
>> = (GENLINE gen, PAGEAPPEND page)VOID: gen(APPEND page), |
||
=: = (GENLINE gen, FILTER filter)GENLINE: filter(gen), |
=: = (GENLINE gen, FILTER filter)GENLINE: filter(gen), |
||
=: = (GENLINE gen, MANYTOONE cmd)GENLINE: cmd(gen);</lang> |
=: = (GENLINE gen, MANYTOONE cmd)GENLINE: cmd(gen);</lang> |
||
⚫ | |||
'''File: Iterator_pipe_utilities.a68''' |
'''File: Iterator_pipe_utilities.a68''' |
||
* |
* c.f. [[User defined pipe and redirection operators/ALGOL 68#Iterator pipe utilities]] |
||
<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''' |
'''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 # |
<lang algol68>#!/usr/local/bin/a68g --script # |
||
# First define what kind of record (aka LINE) we are piping and filtering # |
# First define what kind of record (aka LINE) we are piping and filtering # |