CVS: sml/src/smlnj-lib/Util atom-sig.sml,1.2,1.3 atom-table.sml,1.2,1.3 atom.sml,1.4,1.5
John Reppy <[email protected]>
| Newsgroups | gmane.comp.lang.sml.smlnj.commits |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/smlnj/sml/src/smlnj-lib/Util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30219/Util
Modified Files:
atom-sig.sml atom-table.sml atom.sml
Log Message:
Added Atom.same and Atom.lexCompare functions.
Index: atom-sig.sml
===================================================================
RCS file: /cvsroot/smlnj/sml/src/smlnj-lib/Util/atom-sig.sml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** atom-sig.sml 1 Jun 2000 18:33:56 -0000 1.2
--- atom-sig.sml 11 Feb 2005 15:48:29 -0000 1.3
***************
*** 20,31 ****
val atom' : substring -> atom
(* Map a string/substring to the corresponding unique atom. *)
val toString : atom -> string
(* return the string representation of the atom *)
val sameAtom : (atom * atom) -> bool
! (* return true if the atoms are the same *)
val compare : (atom * atom) -> order
(* compare two atoms for their relative order; note that this is
* not lexical order!
*)
val hash : atom -> word
(* return a hash key for the atom *)
--- 20,40 ----
val atom' : substring -> atom
(* Map a string/substring to the corresponding unique atom. *)
+
val toString : atom -> string
(* return the string representation of the atom *)
+
+ val same : (atom * atom) -> bool
val sameAtom : (atom * atom) -> bool
! (* return true if the atoms are the same; we provide "sameAtom" for
! * backward compatibility.
! *)
!
val compare : (atom * atom) -> order
(* compare two atoms for their relative order; note that this is
* not lexical order!
*)
+ val lexCompare : (atom * atom) -> order
+ (* compare two atoms for their lexical order *)
+
val hash : atom -> word
(* return a hash key for the atom *)
Index: atom-table.sml
===================================================================
RCS file: /cvsroot/smlnj/sml/src/smlnj-lib/Util/atom-table.sml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** atom-table.sml 1 Jun 2000 18:33:56 -0000 1.2
--- atom-table.sml 11 Feb 2005 15:48:29 -0000 1.3
***************
*** 9,13 ****
type hash_key = Atom.atom
val hashVal = Atom.hash
! val sameKey = Atom.sameAtom
end);
--- 9,13 ----
type hash_key = Atom.atom
val hashVal = Atom.hash
! val sameKey = Atom.same
end);
Index: atom.sml
===================================================================
RCS file: /cvsroot/smlnj/sml/src/smlnj-lib/Util/atom.sml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** atom.sml 16 Dec 2004 05:07:47 -0000 1.4
--- atom.sml 11 Feb 2005 15:48:29 -0000 1.5
***************
*** 27,33 ****
(* return true if the atoms are the same *)
! fun sameAtom (ATOM{hash=h1, id=id1}, ATOM{hash=h2, id=id2}) =
(h1 = h2) andalso (id1 = id2)
(* compare two names for their relative order; note that this is
* not lexical order!
--- 27,36 ----
(* return true if the atoms are the same *)
! fun same (ATOM{hash=h1, id=id1}, ATOM{hash=h2, id=id2}) =
(h1 = h2) andalso (id1 = id2)
+ (* for backward compatibility *)
+ val sameAtom = same
+
(* compare two names for their relative order; note that this is
* not lexical order!
***************
*** 38,41 ****
--- 41,47 ----
else GREATER
+ (* compare two atoms for their lexical order *)
+ fun lexCompare (ATOM{id=id1, ...}, ATOM{id=id2, ...}) = String.compare(id1, id2)
+
(* the unique name hash table *)
val tableSz = 64
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click