## stream.pkg
# Compiled by:
#
src/lib/std/standard.lib# Lazy streams. # Should be renamed something like lazy_stream if general purpose, else yacc_lazy_stream. XXX SUCKO FIXME
### "Writing is easy. All you do is stare
### at a blank sheet of paper until drops
### of blood form on your forehead."
###
### -- Gene Fowler
package stream
: Stream # Stream is from
src/app/yacc/lib/base.api{
Str(X)
= EVAL (X, Ref( Str(X) ))
| UNEVAL (Void -> X)
;
Stream(X)
=
Ref( Str(X) );
fun get (REF (EVAL t))
=>
t;
get (s as REF (UNEVAL f))
=>
{ t = (f(), REF (UNEVAL f));
s := EVAL t;
t;
};
end;
fun streamify f = REF (UNEVAL f);
fun cons (a, s) = REF (EVAL (a, s));
};
## Mythryl-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.