Annotation of researchv10no/cmd/sml/src/parse/stream.sml, revision 1.1

1.1     ! root        1: (* Copyright 1989 by AT&T Bell Laboratories *)
        !             2: signature STREAM =
        !             3:  sig type 'a stream
        !             4:      val streamify : (unit -> '1a) -> '1a stream
        !             5:      val cons : '1a * '1a stream -> '1a stream
        !             6:      val get : '1a stream -> '1a * '1a stream
        !             7:  end
        !             8: 
        !             9: abstraction Stream : STREAM =
        !            10: struct
        !            11:    datatype 'a str = EVAL of 'a * 'a str ref | UNEVAL of (unit->'a)
        !            12: 
        !            13:    type 'a stream = 'a str ref
        !            14: 
        !            15:    fun get(ref(EVAL t)) = t
        !            16:      | get(s as ref(UNEVAL f)) = 
        !            17:            let val t = (f(), ref(UNEVAL f)) in s := EVAL t; t end
        !            18: 
        !            19:    fun streamify f = ref(UNEVAL f)
        !            20:    fun cons(a,s) = ref(EVAL(a,s))
        !            21: 
        !            22: end

unix.superglobalmegacorp.com

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