diff options
author | dos-reis <gdr@axiomatics.org> | 2009-10-14 23:54:30 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-10-14 23:54:30 +0000 |
commit | 67a514d354eabbb78771e95e39d3de95c49966cd (patch) | |
tree | 88dd09356cf31433e5fb252305b6b412a3ddad7c /src | |
parent | 10795b52e7bb88d8e9f545e3507cf10f60294eb9 (diff) | |
download | open-axiom-67a514d354eabbb78771e95e39d3de95c49966cd.tar.gz |
* algebra/string.spad.pamphlet (hash$IndexedString): Simplify.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/algebra/string.spad.pamphlet | 14 |
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 |