User defined pipe and redirection operators/ALGOL 68: Difference between revisions
User defined pipe and redirection operators/ALGOL 68 (view source)
Revision as of 08:55, 30 August 2022
, 1 year agoFixed syntax highlighting.
(→Iterator_pipe_page: Fixed WRITE and page append line so there isn't an empty element at the start) |
m (Fixed syntax highlighting.) |
||
(One intermediate revision by one other user not shown) | |||
Line 3:
==Iterator_pipe_operators==
'''File: Iterator_pipe_operators.a68'''
<
PAGEIN = PAGE,
PAGEAPPEND = REF PAGE,
Line 23:
>> = (GENLINE gen, PAGEAPPEND page)VOID: gen(APPEND page),
=: = (GENLINE gen, FILTER filter)GENLINE: filter(gen),
=: = (GENLINE gen, MANYTOONE cmd)GENLINE: cmd(gen);</
==Iterator_pipe_utilities==
'''File: Iterator_pipe_utilities.a68'''
<
FOR gen line FROM LWB argv TO UPB argv DO
argv[gen line](yield)
Line 121 ⟶ 122:
# Define an optional monadic OPerator #
OP TAIL = (INT n)MANYTOONE: tail(n, );</
==Iterator_pipe_page==
'''File: Iterator_pipe_page.a68'''
<
OP +:= = (PAGEOUT page, LINE line)MOID:(
[LWB page:UPB page+1]LINE out;
Line 149 ⟶ 150:
OP APPEND = (PAGEAPPEND page)YIELDLINE:
page append line(page, );</
==test_Iterator_pipe_page==
'''File: test_Iterator_pipe_page.a68'''
<
# First define what kind of record (aka LINE) we are piping and filtering #
FORMAT line fmt = $xg$;
Line 205 ⟶ 206:
$"Number of Algol pioneers: "g(-0)$, UPB algol pioneers list, $l$,
$"Number of scientists: "g(-0)$, UPB the scientists list, $l$
))</
'''Output:'''
<pre>
|