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

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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 9 - (download) (annotate)
Sun Jan 18 01:01:29 1998 UTC (22 years, 2 months ago) by monnier
File size: 904 byte(s)
This commit was generated by cvs2svn to compensate for changes in r8,
which included commits to RCS files with non-trunk default branches.
(* queue.sml
 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories.  See COPYRIGHT file for details.
 * Imperative fifos

structure Queue :> QUEUE =
    type 'a queue = 'a Fifo.fifo ref

    exception Dequeue = Fifo.Dequeue

    fun mkQueue () = ref Fifo.empty

    fun clear q = (q := Fifo.empty)

    fun enqueue (q,x) = q := (Fifo.enqueue (!q, x))

    fun dequeue q = let 
          val (newq, x) = Fifo.dequeue (!q) 
            q := newq;
    fun delete (q, pred) = (q := Fifo.delete (!q, pred))
    fun head q = Fifo.head (!q)
    fun peek q = Fifo.peek (!q)
    fun isEmpty q = Fifo.isEmpty (!q)
    fun length q = Fifo.length (!q)
    fun contents q = Fifo.contents (!q)
    fun app f q = Fifo.app f (!q)
    fun map f q = ref(Fifo.map f (!q))
    fun foldl f b q = Fifo.foldl f b (!q)
    fun foldr f b q = Fifo.foldr f b (!q)


ViewVC Help
Powered by ViewVC 1.0.0