aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/string.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-10-14 23:54:30 +0000
committerdos-reis <gdr@axiomatics.org>2009-10-14 23:54:30 +0000
commit67a514d354eabbb78771e95e39d3de95c49966cd (patch)
tree88dd09356cf31433e5fb252305b6b412a3ddad7c /src/algebra/string.spad.pamphlet
parent10795b52e7bb88d8e9f545e3507cf10f60294eb9 (diff)
downloadopen-axiom-67a514d354eabbb78771e95e39d3de95c49966cd.tar.gz
* algebra/string.spad.pamphlet (hash$IndexedString): Simplify.
Diffstat (limited to 'src/algebra/string.spad.pamphlet')
-rw-r--r--src/algebra/string.spad.pamphlet14
1 files changed, 4 insertions, 10 deletions
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