diff options
author | dos-reis <gdr@axiomatics.org> | 2009-06-11 23:00:40 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-06-11 23:00:40 +0000 |
commit | 9e07dcd91c45bf8b22d932321f5c97e931ffe8ac (patch) | |
tree | 6d2174e90e5779b1b3ab4ae7df3ae6603b66c6c2 /src/algebra/sets.spad.pamphlet | |
parent | 7bd82b57975bbc1ff5b87fed0739815c620ecdcc (diff) | |
download | open-axiom-9e07dcd91c45bf8b22d932321f5c97e931ffe8ac.tar.gz |
* algebra/: Don't quote '!' at end of names.
Diffstat (limited to 'src/algebra/sets.spad.pamphlet')
-rw-r--r-- | src/algebra/sets.spad.pamphlet | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/algebra/sets.spad.pamphlet b/src/algebra/sets.spad.pamphlet index 49bcab03..344d5cbb 100644 --- a/src/algebra/sets.spad.pamphlet +++ b/src/algebra/sets.spad.pamphlet @@ -50,18 +50,18 @@ Set(S:SetCategory): FiniteSetAggregate S == add parts s == parts(s)$Rep inspect s == (empty? s => error "Empty set"; s(maxIndex s)) - extract_! s == + extract! s == x := inspect s - delete_!(s, maxIndex s) + delete!(s, maxIndex s) x find(f, s) == find(f, s)$Rep - map(f, s) == map_!(f,copy s) + map(f, s) == map!(f,copy s) - map_!(f,s) == - map_!(f,s)$Rep - removeDuplicates_! s + map!(f,s) == + map!(f,s)$Rep + removeDuplicates! s reduce(f, s) == reduce(f, s)$Rep @@ -83,14 +83,14 @@ Set(S:SetCategory): FiniteSetAggregate S == add zero?(n := #l) => empty() a := new(n, first l) for i in minIndex(a).. for x in l repeat a.i := x - removeDuplicates_! sort_! a + removeDuplicates! sort! a - insert_!(x, s) == + insert!(x, s) == n := inc maxIndex s k := minIndex s while k < n and x > s.k repeat k := inc k k < n and s.k = x => s - insert_!(x, s, k) + insert!(x, s, k) member?(x, s) == -- binary search empty? s => false @@ -101,11 +101,11 @@ Set(S:SetCategory): FiniteSetAggregate S == add if x > s.m then b := m+1 else t := m x = s.t - remove_!(x:S, s:%) == + remove!(x:S, s:%) == n := inc maxIndex s k := minIndex s while k < n and x > s.k repeat k := inc k - k < n and x = s.k => delete_!(s, k) + k < n and x = s.k => delete!(s, k) s -- the set operations are implemented as variations of merging @@ -116,7 +116,7 @@ Set(S:SetCategory): FiniteSetAggregate S == add j := minIndex t r := empty() while i <= m and j <= n repeat - s.i = t.j => (concat_!(r, s.i); i := i+1; j := j+1) + s.i = t.j => (concat!(r, s.i); i := i+1; j := j+1) if s.i < t.j then i := i+1 else j := j+1 r @@ -128,9 +128,9 @@ Set(S:SetCategory): FiniteSetAggregate S == add r := empty() while i <= m and j <= n repeat s.i = t.j => (i := i+1; j := j+1) - s.i < t.j => (concat_!(r, s.i); i := i+1) + s.i < t.j => (concat!(r, s.i); i := i+1) j := j+1 - while i <= m repeat (concat_!(r, s.i); i := i+1) + while i <= m repeat (concat!(r, s.i); i := i+1) r symmetricDifference(s, t) == @@ -140,11 +140,11 @@ Set(S:SetCategory): FiniteSetAggregate S == add j := minIndex t r := empty() while i <= m and j <= n repeat - s.i < t.j => (concat_!(r, s.i); i := i+1) - s.i > t.j => (concat_!(r, t.j); j := j+1) + s.i < t.j => (concat!(r, s.i); i := i+1) + s.i > t.j => (concat!(r, t.j); j := j+1) i := i+1; j := j+1 - while i <= m repeat (concat_!(r, s.i); i := i+1) - while j <= n repeat (concat_!(r, t.j); j := j+1) + while i <= m repeat (concat!(r, s.i); i := i+1) + while j <= n repeat (concat!(r, t.j); j := j+1) r subset?(s, t) == @@ -166,24 +166,24 @@ Set(S:SetCategory): FiniteSetAggregate S == add j := minIndex t r := empty() while i <= m and j <= n repeat - s.i = t.j => (concat_!(r, s.i); i := i+1; j := j+1) - s.i < t.j => (concat_!(r, s.i); i := i+1) - (concat_!(r, t.j); j := j+1) - while i <= m repeat (concat_!(r, s.i); i := i+1) - while j <= n repeat (concat_!(r, t.j); j := j+1) + s.i = t.j => (concat!(r, s.i); i := i+1; j := j+1) + s.i < t.j => (concat!(r, s.i); i := i+1) + (concat!(r, t.j); j := j+1) + while i <= m repeat (concat!(r, s.i); i := i+1) + while j <= n repeat (concat!(r, t.j); j := j+1) r else - insert_!(x, s) == + insert!(x, s) == for k in minIndex s .. maxIndex s repeat s.k = x => return s - insert_!(x, s, inc maxIndex s) + insert!(x, s, inc maxIndex s) - remove_!(x:S, s:%) == + remove!(x:S, s:%) == n := inc maxIndex s k := minIndex s while k < n repeat - x = s.k => return delete_!(s, k) + x = s.k => return delete!(s, k) k := inc k s |