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 /smlnj-lib/trunk/Util/queue-sig.sml
ViewVC logotype

View of /smlnj-lib/trunk/Util/queue-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2449 - (download) (annotate)
Tue Apr 24 15:10:24 2007 UTC (11 years, 10 months ago) by jhr
File size: 1233 byte(s)
  Added next function to Fifo and Queue modules.
(* queue-sig.sml
 *
 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories.  See COPYRIGHT file for details.
 *
 * Imperative fifos
 *
 *)

signature QUEUE =
  sig
    type 'a queue

    exception Dequeue

    val mkQueue : unit -> 'a queue
	(* make a new queue *)
    val clear : 'a queue -> unit
	(* remove all elements *)
    val isEmpty : 'a queue -> bool
	(* test for empty queue *)
    val enqueue : 'a queue * 'a -> unit
	(* enqueue an element at the rear *)
    val dequeue : 'a queue -> 'a
	(* remove the front element (raise Dequeue if empty) *)
    val next : 'a queue -> 'a option
	(* remove the first element; return NONE if the queue is empty *)
    val delete : ('a queue * ('a -> bool)) -> unit
	(* delete all elements satisfying the given predicate *)
    val head : 'a queue -> 'a
	(* return the first queue element without removing it *)
    val peek : 'a queue -> 'a option
	(* peek at the first queue element without removing it *)
    val length : 'a queue -> int
    val contents : 'a queue -> 'a list
    val app : ('a -> unit) -> 'a queue -> unit
    val map : ('a -> 'b) -> 'a queue -> 'b queue
    val foldl : ('a * 'b -> 'b) -> 'b -> 'a queue -> 'b
    val foldr : ('a * 'b -> 'b) -> 'b -> 'a queue -> 'b

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0