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/ckit/src/ast/uid-fn.sml
ViewVC logotype

View of /sml/trunk/ckit/src/ast/uid-fn.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 597 - (download) (annotate)
Wed Apr 5 18:34:51 2000 UTC (19 years, 3 months ago) by dbm
File size: 533 byte(s)
Initial revision
(* Copyright (c) 1998 by Lucent Technologies *)

(* a functor for creating new categories of unique ids *)

functor UidFn (val initial: int
	       val prefix: string) :> UID =
struct

  type uid = int

  val initial = initial

  val counter = ref initial

  fun new () = let val n = !counter
                in counter := n + 1;
		   n
	       end

  fun reset n = counter := n

  fun toString x = prefix ^ (Int.toString x)

  val toWord = Word.fromInt

  fun equal (uid:uid, uid') = (uid = uid')

  val compare = Int.compare

end


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