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/Doc/mldoc/queue.mldoc
ViewVC logotype

View of /sml/trunk/src/smlnj-lib/Doc/mldoc/queue.mldoc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (download) (annotate)
Sat Nov 7 20:11:41 1998 UTC (21 years, 4 months ago) by monnier
File size: 4480 byte(s)
This commit was generated by cvs2svn to compensate for changes in r167,
which included commits to RCS files with non-trunk default branches.
<!-- queue.mldoc -->

<!DOCTYPE ML-DOC SYSTEM>

<COPYRIGHT OWNER="AT&AMP;T Bell Laboratories" YEAR=1996>
<VERSION VERID="1.0" YEAR=1996 MONTH=5 DAY=29>
<TITLE>The QUEUE signature</TITLE>

<SECT>
<HEAD>The <CD/QUEUE/ signature</HEAD>

<PP>
The <STRREF TOPID NOLINK/Queue/ structure provides imperative first-in/first-out
queues.
<STRUCTURE STRID="Queue">
  <SIGBODY SIGID="QUEUE" FILE=QUEUE-SIG>
    <SPEC>
      <TYPE><TYPARAM>'a<ID>queue
      <COMMENT>
	Imperative first-in/first-out queues.
    <SPEC>
      <EXN>Dequeue
      <COMMENT>
	This exception is raised when attempting to remove an element from
	and empty queue.
	It is the same exception as <EXNREF STRID="Fifo"/Dequeue/.
    <SPEC>
      <VAL>mkQueue<TY>unit -> 'a queue
        <COMMENT>
          <PROTOTY>
          mkQueue ()
          </PROTOTY>
          creates a new, empty, queue.
    <SPEC>
      <VAL>isEmpty<TY>'a queue -> bool
        <COMMENT>
          <PROTOTY>
          isEmpty <ARG/q/
          </PROTOTY>
          returns <CD/true/, if the queue <ARG/q/ is empty.
    <SPEC>
      <VAL>enqueue<TY>('a queue * 'a) -> unit
        <COMMENT>
          <PROTOTY>
          enqueue (<ARG/q/, <ARG/a/)
          </PROTOTY>
          adds the element <ARG/a/ to the end of the queue.
    <SPEC>
      <VAL>dequeue<TY>'a queue -> 'a
        <RAISES><EXNREF/Dequeue/
        <COMMENT>
          <PROTOTY>
          dequeue <ARG/q/
          </PROTOTY>
          removes and returns the first element of the queue <ARG/q/.
	  If <ARG/q/ is empty, then the exception <EXNREF/Dequeue/ is
	  raised.
    <SPEC>
      <VAL>delete<TY>('a queue * ('a -> bool)) -> unit
        <COMMENT>
          <PROTOTY>
          delete (<ARG/q/, <ARG/pred/)
          </PROTOTY>
          deletes the first element in <ARG/q/ that satisfies the predicate
	  <ARG/pred/.
    <SPEC>
      <VAL>head<TY>'a queue -> 'a
        <RAISES><EXNREF/Dequeue/
        <COMMENT>
          <PROTOTY>
          head <ARG/q/
          </PROTOTY>
          returns the first element of the queue <ARG/q/ (without removing it).
	  If <ARG/q/ is empty, then the exception <EXNREF/Dequeue/ is
	  raised.
    <SPEC>
      <VAL>peek<TY>'a queue -> 'a option
        <COMMENT>
          <PROTOTY>
          peek <ARG/q/
          </PROTOTY>
          returns the first element of the queue <ARG/q/, or
	  <CONREF STRID="General" DOCUMENT=SML-BASIS-DOC/NONE/ if
	  <ARG/q/ is empty.
    <SPEC>
      <VAL>length<TY>'a queue -> int
        <COMMENT>
          <PROTOTY>
          length <ARG/q/
          </PROTOTY>
          returns the number of elements in the queue <ARG/q/.
    <SPEC>
      <VAL>contents<TY>'a queue -> 'a list
        <COMMENT>
          <PROTOTY>
          contents <ARG/q/
          </PROTOTY>
          returns the list of elements in the queue <ARG/q/ in the order
	  that they were inserted.
    <SPEC>
      <VAL>app<TY>('a -> unit) -> 'a queue -> unit
        <COMMENT>
          <PROTOTY>
          app <ARG/f/ <ARG/q/
          </PROTOTY>
          explain the use and semantics of app HERE.
          This is equivalent to the expression:
	  <CODE>
	    <VALREF STRID="List" DOCUMENT=SML-BASIS-DOC/List.app/ <ARG/f/ (<VALREF/contents/ <ARG/q/)
	  </CODE>
    <SPEC>
      <VAL>map<TY>('a -> 'b) -> 'a queue -> 'b queue
        <COMMENT>
          <PROTOTY>
          map <ARG/f/ <ARG/q/
          </PROTOTY>
          explain the use and semantics of map HERE.
          This is equivalent to the expression:
	  <CODE>
	    <VALREF STRID="List" DOCUMENT=SML-BASIS-DOC/List.map/ <ARG/f/ (<VALREF/contents/ <ARG/q/)
	  </CODE>
    <SPEC>
      <VAL>foldl<TY>(('a * 'b) -> 'b) -> 'b -> 'a queue -> 'b
        <COMMENT>
          <PROTOTY>
          foldl <ARG/f/ <ARG/init/ <ARG/q/
          </PROTOTY>
          explain the use and semantics of foldl HERE.
          This is equivalent to the expression:
	  <CODE>
	    <VALREF STRID="List" DOCUMENT=SML-BASIS-DOC/List.foldl/ <ARG/f/ <ARG/init/ (<VALREF/contents/ <ARG/q/)
	  </CODE>
    <SPEC>
      <VAL>foldr<TY>(('a * 'b) -> 'b) -> 'b -> 'a queue -> 'b
        <COMMENT>
          <PROTOTY>
          foldr <ARG/f/ <ARG/init/ <ARG/q/
          </PROTOTY>
          explain the use and semantics of foldr HERE.
          This is equivalent to the expression:
	  <CODE>
	    <VALREF STRID="List" DOCUMENT=SML-BASIS-DOC/List.foldr/ <ARG/f/ <ARG/init/ (<VALREF/contents/ <ARG/q/)
	  </CODE>
  </SIGBODY>
  <SEEALSO>
    <STRREF TOPID/Fifo/
  </SEEALSO>
</STRUCTURE>

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