equal
deleted
inserted
replaced
297 fun single x = Seq(Lazy.value (SOME(x,Seq (Lazy.value NONE)))) |
297 fun single x = Seq(Lazy.value (SOME(x,Seq (Lazy.value NONE)))) |
298 fun cons a = Seq(Lazy.value (SOME a)) |
298 fun cons a = Seq(Lazy.value (SOME a)) |
299 |
299 |
300 fun cycle seqfn = |
300 fun cycle seqfn = |
301 let |
301 let |
302 val knot = ref (Seq (Lazy.value NONE)) |
302 val knot = Unsynchronized.ref (Seq (Lazy.value NONE)) |
303 in |
303 in |
304 knot := seqfn (fn () => !knot); |
304 knot := seqfn (fn () => !knot); |
305 !knot |
305 !knot |
306 end |
306 end |
307 |
307 |
348 |
348 |
349 val of_string = of_list o String.explode |
349 val of_string = of_list o String.explode |
350 |
350 |
351 fun of_instream is = |
351 fun of_instream is = |
352 let |
352 let |
353 val buffer : char list ref = ref [] |
353 val buffer : char list Unsynchronized.ref = Unsynchronized.ref [] |
354 fun get_input () = |
354 fun get_input () = |
355 case !buffer of |
355 case !buffer of |
356 (c::cs) => (buffer:=cs; |
356 (c::cs) => (buffer:=cs; |
357 SOME c) |
357 SOME c) |
358 | [] => (case String.explode (TextIO.input is) of |
358 | [] => (case String.explode (TextIO.input is) of |