Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/ml-yacc/lib/stream.sml
ViewVC logotype

View of /sml/trunk/src/ml-yacc/lib/stream.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 656 - (download) (annotate)
Fri Jun 9 03:39:04 2000 UTC (21 years, 3 months ago) by blume
File size: 511 byte(s)
removed RCS log entries; smal bug fix to ml-yacc and ml-lex
(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)

(* Stream: a structure implementing a lazy stream.  The signature STREAM
   is found in base.sig *)

structure Stream :> STREAM =
   datatype 'a str = EVAL of 'a * 'a str ref | UNEVAL of (unit->'a)

   type 'a stream = 'a str ref

   fun get(ref(EVAL t)) = t
     | get(s as ref(UNEVAL f)) = 
	    let val t = (f(), ref(UNEVAL f)) in s := EVAL t; t end

   fun streamify f = ref(UNEVAL f)
   fun cons(a,s) = ref(EVAL(a,s))


ViewVC Help
Powered by ViewVC 1.0.0