home *** CD-ROM | disk | FTP | other *** search
File List | 1986-04-14 | 896 b | 37 lines |
-
-
- Iε thσ nex⌠ figurσ thσ Small-╪ rule≤ needeΣ t∩ reaΣ ß filσ anΣ ì
- accumulatσ thσ element≤ reaΣ int∩ ß lis⌠ i≤ shown.
-
- if not in-memory(#list) then
- {
- %
- % initialize the list, open the input file and read an
- % element of the list
- %
- bind #list []
- open 'data.fil' as infile for input
- read file infile #element
- }
- [reader] if #element <> 'end of file' then
- {
- %
- % as long as we have not reached the end of file add
- % the element to the list and read another. Make this
- % rule available to be fired again.
- %
- compute #list <- #list + #element
- read file infile #element
- reset reader
- }
- [halter] if #element = 'end of file' then
- {
- %
- % when end of file is reached close the input file
- % and halt the engine
- %
- close infile
- halt
- }
-