Guest User

Untitled

a guest
May 9th, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. signature STREAM =
  2. sig
  3.   type 'a stream   (* abstract *)
  4.  datatype 'a front = Empty | Cons of 'a * 'a stream
  5.  
  6.   (* Lazy stream construction and exposure *)
  7.   val delay : (unit -> 'a front) -> 'a stream
  8.   val expose : 'a stream -> 'a front
  9.  
  10.   (* Eager stream construction *)
  11.   val empty : 'a stream
  12.  val cons : 'a * 'a stream -> 'a stream
  13.  
  14.   exception EmptyStream
  15.  
  16.   val null : 'a stream -> bool
  17.  val hd : 'a stream -> 'a
  18.  val tl : 'a stream -> 'a stream
  19.  
  20.  val map : ('a -> 'b) -> 'a stream -> 'b stream
  21.  val filter : ('a -> bool) -> 'a stream -> 'a stream
  22.   val exists : ('a -> bool) -> 'a stream -> bool
  23.  
  24.   val zip : 'a stream * 'b stream -> ('a * 'b) stream
  25.  
  26.   val take : 'a stream * int -> 'a list
  27.   val drop : 'a stream * int -> 'a stream
  28.  
  29.   val tabulate : (int -> 'a) -> 'a stream
  30.  
  31.   val append : 'a stream * 'a stream -> 'a stream
  32. end
Advertisement
Add Comment
Please, Sign In to add comment