aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog4
-rw-r--r--src/algebra/string.spad.pamphlet14
2 files changed, 8 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f52e64d1..dbba0800 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
2009-10-14 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * algebra/string.spad.pamphlet (hash$IndexedString): Simplify.
+
+2009-10-14 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/i-funsel.boot (findFunctionInDomain): Fix thinko.
2009-10-12 Kostas Oikonomou <ko@research.att.com>
diff --git a/src/algebra/string.spad.pamphlet b/src/algebra/string.spad.pamphlet
index f176ed9d..353ed862 100644
--- a/src/algebra/string.spad.pamphlet
+++ b/src/algebra/string.spad.pamphlet
@@ -255,11 +255,8 @@ IndexedString(mn:Integer): Export == Implementation where
N ==> NonNegativeInteger
U ==> UniversalSegment Integer
- Export ==> StringAggregate() with
- hash: % -> I
- ++ hash(x) provides a hashing function for strings
-
- Implementation ==> add
+ Export == StringAggregate()
+ Implementation == add
-- These assume Character's Rep is Small I
Qelt ==> CHAR$Lisp
Qequal ==> EQUAL$Lisp
@@ -409,11 +406,8 @@ IndexedString(mn:Integer): Export == Implementation where
l < 0 or h >= #s => error "index out of bound"
SUBSTRING(s, l, max(0, h-l+1))$Lisp
- hash(s:$):Integer ==
- n:I := Qsize s
- zero? n => 0
- one? n => ord(s.mn)
- ord(s.mn) * ord s(mn+n-1) * ord s(mn + n quo 2)
+ hash s ==
+ SXHASH(s)$Foreign(Builtin)
match(pattern,target,wildcard) == stringMatch(pattern,target,CHARACTER(wildcard)$Lisp)$Lisp