Annotation of researchv10dc/cmd/sml/doc/examples/cat.sml, revision 1.1.1.1

1.1       root        1: datatype limit = Unbounded | Limited of int
                      2: 
                      3: fun cat Unbounded (instream,outstream) =
                      4:     while not (end_of_stream instream) do
                      5:          output outstream (input instream (can_input instream))
                      6:   | cat (Limited limit) (instream,outstream) =
                      7:     while not (end_of_stream instream) do
                      8:          output outstream (input instream (min(can_input instream,limit)))
                      9:       
                     10: val ucat = cat Unbounded
                     11: val lcat = cat(Limited 1024)
                     12: 
                     13: fun cat1 (instream,outstream) =
                     14:     while not (end_of_stream instream) do
                     15:          output outstream (input instream 1)
                     16: 
                     17: fun filecat cat = fn (fin,fout) => cat(open_in fin,open_out fout)
                     18: fun screencat cat = fn fin => cat(open_in fin,std_out)
                     19: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.