User defined pipe and redirection operators/ALGOL 68: Difference between revisions
Content added Content deleted
(split page from task main) |
m (Add section titles) |
||
Line 1: | 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].}} |
{{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''.}} |
{{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''' |
'''File: Iterator_pipe_operators.a68''' |
||
<lang algol68>MODE |
<lang algol68>MODE |
||
Line 22: | Line 23: | ||
>> = (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> |
||
==Iterator_pipe_utilities== |
|||
'''File: Iterator_pipe_utilities.a68''' |
|||
<lang algol68>PROC cat yield line = ([]GENLINE argv, YIELDLINE yield)VOID: |
<lang algol68>PROC cat yield line = ([]GENLINE argv, YIELDLINE yield)VOID: |
||
FOR gen line FROM LWB argv TO UPB argv DO |
FOR gen line FROM LWB argv TO UPB argv DO |
||
Line 118: | Line 121: | ||
# Define an optional monadic OPerator # |
# Define an optional monadic OPerator # |
||
OP TAIL = (INT n)MANYTOONE: tail(n, );</lang> |
OP TAIL = (INT n)MANYTOONE: tail(n, );</lang> |
||
==Iterator_pipe_page== |
|||
'''File: Iterator_pipe_page.a68''' |
|||
<lang algol68># Define the required OPerators for pipes of user-defined type "PAGE" # |
<lang algol68># Define the required OPerators for pipes of user-defined type "PAGE" # |
||
OP +:= = (PAGEOUT page, LINE line)MOID:( |
OP +:= = (PAGEOUT page, LINE line)MOID:( |
||
Line 144: | Line 149: | ||
OP APPEND = (PAGEAPPEND page)YIELDLINE: |
OP APPEND = (PAGEAPPEND page)YIELDLINE: |
||
page append line(page, );</lang> |
page append line(page, );</lang> |
||
==test_Iterator_pipe_page== |
|||
'''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 # |