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 /eXene/trunk/styles/quark.sml
ViewVC logotype

View of /eXene/trunk/styles/quark.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 2098 - (download) (annotate)
Thu Nov 2 15:53:59 2006 UTC (12 years, 10 months ago) by blume
File size: 849 byte(s)
moved eXene to toplevel
(* quark.sml
 * COPYRIGHT (c) 1994 by AT&T Bell Laboratories.  See COPYRIGHT file for details.
 * Strings with fast inequality operations.  This should probably be replaced
 * with "names," but there are problems with creating names that are statically
 * initialized in CML.  Once there is a "CML shell," we can replace this by
 * the CML_Name structure.

structure Quark :> QUARK =

    datatype quark = Q of {str : string, hash : word}

    fun quark s = Q{str = s, hash = HashString.hashString s}

    fun stringOf (Q{str, ...}) = str

    fun same (Q{str=s1, hash=h1}, Q{str=s2, hash=h2}) =
	  (h1 = h2) andalso (s1 = s2)

    fun hash (Q{hash, ...}) = hash

    fun cmp (Q{str=s1, hash=h1}, Q{str=s2, hash=h2}) =
	  if (h1 < h2)
	    then LESS
	  else if (h2 < h1)
	    then GREATER
	    else String.compare(s1, s2)


ViewVC Help
Powered by ViewVC 1.0.0