User defined pipe and redirection operators/ALGOL 68: Difference between revisions

m
Add section titles
(split page from task main)
 
m (Add section titles)
Line 1:
{{works with|ALGOL 68|Revision 1; one minor extension - PRAGMA READ; one major extension - Algol68G's [[wp:Currying|Currying]].}}{{works with|ALGOL 68G|tested with release [http://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.18.0/algol68g-1.18.0-9h.tiny.el5.centos.fc11.i386.rpm/download 1.18.0-9h.tiny].}}
{{wont work with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68toc/algol68toc-1.8.8d/algol68toc-1.8-8d.fc9.i386.rpm/download 1.8-8d] - due to extensive use of '''format'''[ted] ''transput''.}}
==Iterator_pipe_operators==
'''File: Iterator_pipe_operators.a68'''
<lang algol68>MODE
Line 22 ⟶ 23:
>> = (GENLINE gen, PAGEAPPEND page)VOID: gen(APPEND page),
=: = (GENLINE gen, FILTER filter)GENLINE: filter(gen),
=: = (GENLINE gen, MANYTOONE cmd)GENLINE: cmd(gen);</lang>'''File: Iterator_pipe_utilities.a68'''
==Iterator_pipe_utilities==
'''File: Iterator_pipe_utilities.a68'''
<lang algol68>PROC cat yield line = ([]GENLINE argv, YIELDLINE yield)VOID:
FOR gen line FROM LWB argv TO UPB argv DO
Line 118 ⟶ 121:
 
# Define an optional monadic OPerator #
OP TAIL = (INT n)MANYTOONE: tail(n, );</lang>'''File: Iterator_pipe_page.a68'''
==Iterator_pipe_page==
'''File: Iterator_pipe_page.a68'''
<lang algol68># Define the required OPerators for pipes of user-defined type "PAGE" #
OP +:= = (PAGEOUT page, LINE line)MOID:(
Line 144 ⟶ 149:
 
OP APPEND = (PAGEAPPEND page)YIELDLINE:
page append line(page, );</lang>'''File: test_Iterator_pipe_page.a68'''
==test_Iterator_pipe_page==
'''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 #