Anonymous user
User defined pipe and redirection operators/ALGOL 68: Difference between revisions
User defined pipe and redirection operators/ALGOL 68 (view source)
Revision as of 01:19, 28 April 2013
, 11 years agoAdd 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>
==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>
==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>
==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 #
|