diff options
author | dos-reis <gdr@axiomatics.org> | 2013-05-18 06:14:27 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-05-18 06:14:27 +0000 |
commit | 979b28507f84eff5c739879f4b15e595eeab00f9 (patch) | |
tree | 4fb4f1ee6472e1ef7290264c83dde41d21031b67 /src/algebra/lmdict.spad.pamphlet | |
parent | a6ba684e87ea28ea0a5ad8746a15d3575eb5c8f9 (diff) | |
download | open-axiom-979b28507f84eff5c739879f4b15e595eeab00f9.tar.gz |
Define members, not parts
Diffstat (limited to 'src/algebra/lmdict.spad.pamphlet')
-rw-r--r-- | src/algebra/lmdict.spad.pamphlet | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/algebra/lmdict.spad.pamphlet b/src/algebra/lmdict.spad.pamphlet index 0b1e3ee3..a339b019 100644 --- a/src/algebra/lmdict.spad.pamphlet +++ b/src/algebra/lmdict.spad.pamphlet @@ -47,11 +47,11 @@ ListMultiDictionary(S:SetCategory): Join(MultiDictionary S,FiniteAggregate S) wi sub: (S, S, S) -> S coerce(s:%):OutputForm == - prefix("dictionary"::OutputForm, [x::OutputForm for x in parts s]) + prefix("dictionary"::OutputForm, [x::OutputForm for x in members s]) - #s == # parts s - copy s == dictionary copy parts s - empty? s == empty? parts s + #s == # members s + copy s == dictionary copy members s + empty? s == empty? members s bag l == dictionary l dictionary() == dictionary empty() @@ -66,28 +66,28 @@ ListMultiDictionary(S:SetCategory): Join(MultiDictionary S,FiniteAggregate S) wi if S has ConvertibleTo InputForm then convert(lmd:%):InputForm == convert [convert('dictionary)@InputForm, - convert(parts lmd)@InputForm] + convert(members lmd)@InputForm] - map(f, s) == dictionary map(f, parts s) - map!(f, s) == dictionary map!(f, parts s) - parts s == deref s + map(f, s) == dictionary map(f, members s) + map!(f, s) == dictionary map!(f, members s) + members s == deref s sub(x, y, z) == (z = x => y; z) insert!(x, s, n) == (for i in 1..n repeat insert!(x, s); s) - substitute(x, y, s) == dictionary map(sub(x, y, #1), parts s) - removeDuplicates! s == dictionary removeDuplicates! parts s + substitute(x, y, s) == dictionary map(sub(x, y, #1), members s) + removeDuplicates! s == dictionary removeDuplicates! members s inspect s == empty? s => error "empty dictionary" - first parts s + first members s extract! s == empty? s => error "empty dictionary" - x := first(p := parts s) + x := first(p := members s) setref(s, rest p) x duplicates? s == - empty?(p := parts s) => false + empty?(p := members s) => false q := rest p while not empty? q repeat first p = first q => return true @@ -96,20 +96,20 @@ ListMultiDictionary(S:SetCategory): Join(MultiDictionary S,FiniteAggregate S) wi false remove!(p: S->Boolean, lmd:%):% == - for x in removeDuplicates parts lmd | p(x) repeat remove!(x,lmd) + for x in removeDuplicates members lmd | p(x) repeat remove!(x,lmd) lmd select!(p: S->Boolean, lmd:%):% == remove!(not p(#1), lmd) duplicates(lmd:%):List D == ld: List D := empty() - for x in removeDuplicates parts lmd | (n := count(x, lmd)) > + for x in removeDuplicates members lmd | (n := count(x, lmd)) > 1$NonNegativeInteger repeat ld := cons([x, n], ld) ld if S has OrderedSet then - s = t == parts s = parts t + s = t == members s = members t remove!(x:S, s:%) == p := deref s @@ -133,7 +133,7 @@ ListMultiDictionary(S:SetCategory): Join(MultiDictionary S,FiniteAggregate S) wi s else - remove!(x:S, s:%) == (setref(s, remove!(x, parts s)); s) + remove!(x:S, s:%) == (setref(s, remove!(x, members s)); s) s = t == a := copy s |