diff options
Diffstat (limited to 'bitlength/consumer.icl')
-rw-r--r-- | bitlength/consumer.icl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bitlength/consumer.icl b/bitlength/consumer.icl new file mode 100644 index 0000000..67a61ec --- /dev/null +++ b/bitlength/consumer.icl @@ -0,0 +1,20 @@ +module consumer + +import StdEnv +import producer + +Start :: *World -> *World +Start w +# (io,w) = stdio w +# io = fwrites ("See, I can have 64 bits! " +++ toString (2^63-1) +++ "\n") io +# io = consume 0 1 io +# (ok,w) = fclose io w += w +where + consume :: !Int !Int *File -> *File + consume i n io + # (n,io) = (produce n, io) + # io = fwrites (toString i +++ " : " +++ toString n +++ "\n") io + | n <> 0 = consume (i+1) n io + | otherwise = io + |