aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2013-05-17 00:48:29 +0000
committerdos-reis <gdr@axiomatics.org>2013-05-17 00:48:29 +0000
commit1d241c403c1d8e0b3f41093729efd967335c4b93 (patch)
treecc1e691489276a5d94bd7cafde17398207c84cca
parenta77534307be15ee6d85fbc31cc2717cae874d209 (diff)
downloadopen-axiom-1d241c403c1d8e0b3f41093729efd967335c4b93.tar.gz
* algebra/aggcat.spad.pamphlet (AssociationListAggregate) [assoc]:
Change return type to instance of Maybe. * algebra/list.spad.pamphle (AssociationList): Reflect change.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/algebra/aggcat.spad.pamphlet4
-rw-r--r--src/algebra/list.spad.pamphlet4
3 files changed, 10 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9fb6c212..fc269f1a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2013-05-16 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ * algebra/aggcat.spad.pamphlet (AssociationListAggregate) [assoc]:
+ Change return type to instance of Maybe.
+ * algebra/list.spad.pamphle (AssociationList): Reflect change.
+
+2013-05-16 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
* algebra/sortpak.spad.pamphlet (SortPackage): Have second
parameter satisfy FiniteAggregate A instead of requiring attribute
finiteAggregate.
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index 83667f77..576a5a24 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -2599,9 +2599,9 @@ import ListAggregate
++ searching for a key is a linear operation.
AssociationListAggregate(Key:SetCategory,Entry:SetCategory): Category ==
Join(TableAggregate(Key, Entry), ListAggregate Record(key:Key,entry:Entry)) with
- assoc: (Key, %) -> Union(Record(key:Key,entry:Entry), "failed")
+ assoc: (Key, %) -> Maybe Record(key:Key,entry:Entry)
++ assoc(k,u) returns the element x in association list u stored
- ++ with key k, or "failed" if u has no key k.
+ ++ with key k, or \spad{nothing} if u has no key k.
@
diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet
index 9f0cc282..78cb7133 100644
--- a/src/algebra/list.spad.pamphlet
+++ b/src/algebra/list.spad.pamphlet
@@ -506,8 +506,8 @@ AssociationList(Key:SetCategory, Entry:SetCategory):
assoc(k, t) ==
for r in deref t repeat
- k = r.key => return r
- "failed"
+ k = r.key => return just r
+ nothing
setelt(t:%, k:Key, e:Entry) ==
(r := assoc(k, t)) case Pair => (r::Pair).entry := e