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/branches/idlbasis-devel/src/ml-yacc/lib/stream.sml
ViewVC logotype

View of /sml/branches/idlbasis-devel/src/ml-yacc/lib/stream.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 848 - (download) (annotate)
Mon Jun 25 19:29:29 2001 UTC (19 years, 9 months ago)
File size: 511 byte(s)
This commit was manufactured by cvs2svn to create branch
(* 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