## quark.pkg
#
# Strings with fast inequality operations.
#
# This should probably be replaced with "names, "
# but there are problems with creating names
# that are statically initialized in threadkit.
#
# Once there is a "threadkit shell" we can
# replace this by the THREADKIT_Name package.
# Compiled by:
#
src/lib/x-kit/style/xkit-style.sublibpackage quark
: Quark # Quark is from
src/lib/x-kit/style/quark.api{
Quark = QUARK { str: String, hash: Unt };
fun quark s
=
QUARK { str => s, hash => hash_string::hash_string s };
fun string_of (QUARK { str, ... } )
=
str;
fun same (QUARK { str=>s1, hash=>h1 }, QUARK { str=>s2, hash=>h2 } )
=
(h1 == h2) and (s1 == s2);
fun hash (QUARK { hash, ... } )
=
hash;
fun cmp (QUARK { str=>s1, hash=>h1 }, QUARK { str=>s2, hash=>h2 } )
=
if (h1 < h2) LESS;
elif (h2 < h1) GREATER;
else string::compare (s1, s2);
fi;
};
## COPYRIGHT (c) 1994 by AT&T Bell Laboratories. See SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.