aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-06-11 23:00:40 +0000
committerdos-reis <gdr@axiomatics.org>2009-06-11 23:00:40 +0000
commit9e07dcd91c45bf8b22d932321f5c97e931ffe8ac (patch)
tree6d2174e90e5779b1b3ab4ae7df3ae6603b66c6c2 /src/algebra
parent7bd82b57975bbc1ff5b87fed0739815c620ecdcc (diff)
downloadopen-axiom-9e07dcd91c45bf8b22d932321f5c97e931ffe8ac.tar.gz
* algebra/: Don't quote '!' at end of names.
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/aggcat.spad.pamphlet400
-rw-r--r--src/algebra/aggcat2.spad.pamphlet10
-rw-r--r--src/algebra/algcat.spad.pamphlet8
-rw-r--r--src/algebra/algext.spad.pamphlet4
-rw-r--r--src/algebra/algfunc.spad.pamphlet2
-rw-r--r--src/algebra/alql.spad.pamphlet2
-rw-r--r--src/algebra/array1.spad.pamphlet44
-rw-r--r--src/algebra/array2.spad.pamphlet46
-rw-r--r--src/algebra/bags.spad.pamphlet52
-rw-r--r--src/algebra/bezout.spad.pamphlet14
-rw-r--r--src/algebra/carten.spad.pamphlet50
-rw-r--r--src/algebra/clip.spad.pamphlet2
-rw-r--r--src/algebra/combinat.spad.pamphlet2
-rw-r--r--src/algebra/contfrac.spad.pamphlet4
-rw-r--r--src/algebra/cra.spad.pamphlet28
-rw-r--r--src/algebra/curve.spad.pamphlet22
-rw-r--r--src/algebra/defaults.spad.pamphlet18
-rw-r--r--src/algebra/defintef.spad.pamphlet2
-rw-r--r--src/algebra/defintrf.spad.pamphlet6
-rw-r--r--src/algebra/derham.spad.pamphlet2
-rw-r--r--src/algebra/divisor.spad.pamphlet36
-rw-r--r--src/algebra/efstruc.spad.pamphlet6
-rw-r--r--src/algebra/expexpan.spad.pamphlet18
-rw-r--r--src/algebra/expr.spad.pamphlet4
-rw-r--r--src/algebra/ffcat.spad.pamphlet6
-rw-r--r--src/algebra/fff.spad.pamphlet12
-rw-r--r--src/algebra/ffhom.spad.pamphlet24
-rw-r--r--src/algebra/ffnb.spad.pamphlet12
-rw-r--r--src/algebra/ffp.spad.pamphlet8
-rw-r--r--src/algebra/ffpoly.spad.pamphlet14
-rw-r--r--src/algebra/files.spad.pamphlet80
-rw-r--r--src/algebra/fr.spad.pamphlet4
-rw-r--r--src/algebra/free.spad.pamphlet42
-rw-r--r--src/algebra/fspace.spad.pamphlet4
-rw-r--r--src/algebra/intaf.spad.pamphlet4
-rw-r--r--src/algebra/intalg.spad.pamphlet10
-rw-r--r--src/algebra/intaux.spad.pamphlet4
-rw-r--r--src/algebra/intclos.spad.pamphlet32
-rw-r--r--src/algebra/intfact.spad.pamphlet38
-rw-r--r--src/algebra/intpm.spad.pamphlet4
-rw-r--r--src/algebra/intrf.spad.pamphlet4
-rw-r--r--src/algebra/laurent.spad.pamphlet2
-rw-r--r--src/algebra/lingrob.spad.pamphlet6
-rw-r--r--src/algebra/list.spad.pamphlet36
-rw-r--r--src/algebra/lmdict.spad.pamphlet26
-rw-r--r--src/algebra/lodo.spad.pamphlet2
-rw-r--r--src/algebra/lodof.spad.pamphlet10
-rw-r--r--src/algebra/manip.spad.pamphlet4
-rw-r--r--src/algebra/matcat.spad.pamphlet64
-rw-r--r--src/algebra/matfuns.spad.pamphlet62
-rw-r--r--src/algebra/matrix.spad.pamphlet18
-rw-r--r--src/algebra/matstor.spad.pamphlet68
-rw-r--r--src/algebra/mkfunc.spad.pamphlet2
-rw-r--r--src/algebra/mring.spad.pamphlet10
-rw-r--r--src/algebra/mset.spad.pamphlet48
-rw-r--r--src/algebra/mts.spad.pamphlet2
-rw-r--r--src/algebra/naalg.spad.pamphlet8
-rw-r--r--src/algebra/naalgc.spad.pamphlet8
-rw-r--r--src/algebra/newpoint.spad.pamphlet14
-rw-r--r--src/algebra/numtheor.spad.pamphlet4
-rw-r--r--src/algebra/odealg.spad.pamphlet6
-rw-r--r--src/algebra/odeef.spad.pamphlet18
-rw-r--r--src/algebra/oderf.spad.pamphlet12
-rw-r--r--src/algebra/op.spad.pamphlet4
-rw-r--r--src/algebra/opalg.spad.pamphlet8
-rw-r--r--src/algebra/padic.spad.pamphlet4
-rw-r--r--src/algebra/padiclib.spad.pamphlet14
-rw-r--r--src/algebra/patmatch1.spad.pamphlet4
-rw-r--r--src/algebra/pattern.spad.pamphlet2
-rw-r--r--src/algebra/perm.spad.pamphlet2
-rw-r--r--src/algebra/permgrps.spad.pamphlet8
-rw-r--r--src/algebra/pf.spad.pamphlet4
-rw-r--r--src/algebra/pfbr.spad.pamphlet10
-rw-r--r--src/algebra/pfo.spad.pamphlet4
-rw-r--r--src/algebra/pleqn.spad.pamphlet14
-rw-r--r--src/algebra/plot.spad.pamphlet42
-rw-r--r--src/algebra/plot3d.spad.pamphlet42
-rw-r--r--src/algebra/poly.spad.pamphlet4
-rw-r--r--src/algebra/polycat.spad.pamphlet10
-rw-r--r--src/algebra/primelt.spad.pamphlet2
-rw-r--r--src/algebra/pscat.spad.pamphlet2
-rw-r--r--src/algebra/puiseux.spad.pamphlet2
-rw-r--r--src/algebra/radix.spad.pamphlet4
-rw-r--r--src/algebra/realzero.spad.pamphlet2
-rw-r--r--src/algebra/rep2.spad.pamphlet2
-rw-r--r--src/algebra/rf.spad.pamphlet2
-rw-r--r--src/algebra/riccati.spad.pamphlet24
-rw-r--r--src/algebra/rule.spad.pamphlet2
-rw-r--r--src/algebra/seg.spad.pamphlet8
-rw-r--r--src/algebra/sets.spad.pamphlet54
-rw-r--r--src/algebra/sex.spad.pamphlet2
-rw-r--r--src/algebra/sgcf.spad.pamphlet6
-rw-r--r--src/algebra/solvelin.spad.pamphlet4
-rw-r--r--src/algebra/sortpak.spad.pamphlet24
-rw-r--r--src/algebra/space.spad.pamphlet10
-rw-r--r--src/algebra/stream.spad.pamphlet154
-rw-r--r--src/algebra/string.spad.pamphlet24
-rw-r--r--src/algebra/sum.spad.pamphlet2
-rw-r--r--src/algebra/sups.spad.pamphlet2
-rw-r--r--src/algebra/symbol.spad.pamphlet4
-rw-r--r--src/algebra/table.spad.pamphlet4
-rw-r--r--src/algebra/transsolve.spad.pamphlet4
-rw-r--r--src/algebra/tree.spad.pamphlet98
-rw-r--r--src/algebra/tube.spad.pamphlet4
-rw-r--r--src/algebra/vector.spad.pamphlet6
-rw-r--r--src/algebra/view2D.spad.pamphlet4
-rw-r--r--src/algebra/view3D.spad.pamphlet2
-rw-r--r--src/algebra/xlpoly.spad.pamphlet4
-rw-r--r--src/algebra/xpoly.spad.pamphlet14
109 files changed, 1083 insertions, 1083 deletions
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index 9f802495..d8d3b059 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -107,7 +107,7 @@ HomogeneousAggregate(S:Type): Category == Aggregate with
++ map(f,u) returns a copy of u with each element x replaced by f(x).
++ For collections, \axiom{map(f,u) = [f(x) for x in u]}.
if % has shallowlyMutable then
- map_!: (S->S,%) -> %
+ map!: (S->S,%) -> %
++ map!(f,u) destructively replaces each element x of u by \axiom{f(x)}.
if % has finiteAggregate then
any?: (S->Boolean,%) -> Boolean
@@ -270,16 +270,16 @@ BagAggregate(S:Type): Category == HomogeneousAggregate S with
++ shallowlyMutable means that elements of bags may be destructively changed.
bag: List S -> %
++ bag([x,y,...,z]) creates a bag with elements x,y,...,z.
- extract_!: % -> S
+ extract!: % -> S
++ extract!(u) destructively removes a (random) item from bag u.
- insert_!: (S,%) -> %
+ insert!: (S,%) -> %
++ insert!(x,u) inserts item x into bag u.
inspect: % -> S
++ inspect(u) returns an (random) element from a bag.
add
bag(l) ==
x:=empty()
- for s in l repeat x:=insert_!(s,x)
+ for s in l repeat x:=insert!(s,x)
x
@
@@ -303,11 +303,11 @@ import BagAggregate
++ A stack is a bag where the last item inserted is the first item extracted.
StackAggregate(S:Type): Category == BagAggregate S with
finiteAggregate
- push_!: (S,%) -> S
+ push!: (S,%) -> S
++ push!(x,s) pushes x onto stack s, i.e. destructively changing s
++ so as to have a new first (top) element x.
++ Afterwards, pop!(s) produces x and pop!(s) produces the original s.
- pop_!: % -> S
+ pop!: % -> S
++ pop!(s) returns the top element x, destructively removing x from s.
++ Note: Use \axiom{top(s)} to obtain x without removing it from s.
++ Error: if s is empty.
@@ -340,13 +340,13 @@ import BagAggregate
++ A queue is a bag where the first item inserted is the first item extracted.
QueueAggregate(S:Type): Category == BagAggregate S with
finiteAggregate
- enqueue_!: (S, %) -> S
+ enqueue!: (S, %) -> S
++ enqueue!(x,q) inserts x into the queue q at the back end.
- dequeue_!: % -> S
+ dequeue!: % -> S
++ dequeue! s destructively extracts the first (top) element from queue q.
++ The element previously second in the queue becomes the first element.
++ Error: if q is empty.
- rotate_!: % -> %
+ rotate!: % -> %
++ rotate! q rotates queue q so that the element at the front of
++ the queue goes to the back of the queue.
++ Note: rotate! q is equivalent to enqueue!(dequeue!(q)).
@@ -393,27 +393,27 @@ DequeueAggregate(S:Type):
height: % -> NonNegativeInteger
++ height(d) returns the number of elements in dequeue d.
++ Note: \axiom{height(d) = # d}.
- top_!: % -> S
+ top!: % -> S
++ top!(d) returns the element at the top (front) of the dequeue.
- bottom_!: % -> S
+ bottom!: % -> S
++ bottom!(d) returns the element at the bottom (back) of the dequeue.
- insertTop_!: (S,%) -> S
+ insertTop!: (S,%) -> S
++ insertTop!(x,d) destructively inserts x into the dequeue d, that is,
++ at the top (front) of the dequeue.
++ The element previously at the top of the dequeue becomes the
++ second in the dequeue, and so on.
- insertBottom_!: (S,%) -> S
+ insertBottom!: (S,%) -> S
++ insertBottom!(x,d) destructively inserts x into the dequeue d
++ at the bottom (back) of the dequeue.
- extractTop_!: % -> S
+ extractTop!: % -> S
++ extractTop!(d) destructively extracts the top (front) element
++ from the dequeue d.
++ Error: if d is empty.
- extractBottom_!: % -> S
+ extractBottom!: % -> S
++ extractBottom!(d) destructively extracts the bottom (back) element
++ from the dequeue d.
++ Error: if d is empty.
- reverse_!: % -> %
+ reverse!: % -> %
++ reverse!(d) destructively replaces d by its reverse dequeue, i.e.
++ the top (front) element is now the bottom (back) element, and so on.
@@ -443,7 +443,7 @@ PriorityQueueAggregate(S:OrderedSet): Category == BagAggregate S with
merge: (%,%) -> %
++ merge(q1,q2) returns combines priority queues q1 and q2 to return
++ a single priority queue q.
- merge_!: (%,%) -> %
+ merge!: (%,%) -> %
++ merge!(q,q1) destructively changes priority queue q to include the
++ values from priority queue q1.
@@ -476,20 +476,20 @@ DictionaryOperations(S:SetCategory): Category ==
++ entries \axiom{x,y,...,z}.
-- insert: (S,%) -> S ++ insert an entry
-- member?: (S,%) -> Boolean ++ search for an entry
--- remove_!: (S,%,NonNegativeInteger) -> %
+-- remove!: (S,%,NonNegativeInteger) -> %
-- ++ remove!(x,d,n) destructively changes dictionary d by removing
-- ++ up to n entries y such that \axiom{y = x}.
--- remove_!: (S->Boolean,%,NonNegativeInteger) -> %
+-- remove!: (S->Boolean,%,NonNegativeInteger) -> %
-- ++ remove!(p,d,n) destructively changes dictionary d by removing
-- ++ up to n entries x such that \axiom{p(x)} is true.
if % has finiteAggregate then
- remove_!: (S,%) -> %
+ remove!: (S,%) -> %
++ remove!(x,d) destructively changes dictionary d by removing
++ all entries y such that \axiom{y = x}.
- remove_!: (S->Boolean,%) -> %
+ remove!: (S->Boolean,%) -> %
++ remove!(p,d) destructively changes dictionary d by removeing
++ all entries x such that \axiom{p(x)} is true.
- select_!: (S->Boolean,%) -> %
+ select!: (S->Boolean,%) -> %
++ select!(p,d) destructively changes dictionary d by removing
++ all entries x such that \axiom{p(x)} is not true.
add
@@ -528,17 +528,17 @@ Dictionary(S:SetCategory): Category ==
DictionaryOperations S add
dictionary l ==
d := dictionary()
- for x in l repeat insert_!(x, d)
+ for x in l repeat insert!(x, d)
d
if % has finiteAggregate then
- -- remove(f:S->Boolean,t:%) == remove_!(f, copy t)
- -- select(f, t) == select_!(f, copy t)
- select_!(f, t) == remove_!(not f #1, t)
+ -- remove(f:S->Boolean,t:%) == remove!(f, copy t)
+ -- select(f, t) == select!(f, copy t)
+ select!(f, t) == remove!(not f #1, t)
- --extract_! d ==
+ --extract! d ==
-- empty? d => error "empty dictionary"
- -- remove_!(x := first parts d, d, 1)
+ -- remove!(x := first parts d, d, 1)
-- x
s = t ==
@@ -546,8 +546,8 @@ Dictionary(S:SetCategory): Category ==
#s ~= #t => false
and/[member?(x, t) for x in parts s]
- remove_!(f:S->Boolean, t:%) ==
- for m in parts t repeat if f m then remove_!(m, t)
+ remove!(f:S->Boolean, t:%) ==
+ for m in parts t repeat if f m then remove!(m, t)
t
@
@@ -573,12 +573,12 @@ import DictionaryOperations
++ copying (non-destructive) operations are generally to be avoided.
MultiDictionary(S:SetCategory): Category == DictionaryOperations S with
-- count: (S,%) -> NonNegativeInteger ++ multiplicity count
- insert_!: (S,%,NonNegativeInteger) -> %
+ insert!: (S,%,NonNegativeInteger) -> %
++ insert!(x,d,n) destructively inserts n copies of x into dictionary d.
--- remove_!: (S,%,NonNegativeInteger) -> %
+-- remove!: (S,%,NonNegativeInteger) -> %
-- ++ remove!(x,d,n) destructively removes (up to) n copies of x from
-- ++ dictionary d.
- removeDuplicates_!: % -> %
+ removeDuplicates!: % -> %
++ removeDuplicates!(d) destructively removes any duplicate values
++ in dictionary d.
duplicates: % -> List Record(entry:S,count:NonNegativeInteger)
@@ -716,7 +716,7 @@ FiniteSetAggregate(S:SetCategory): Category ==
brace l == construct l
set l == construct l
cardinality s == #s
- construct l == (s := set(); for x in l repeat insert_!(x,s); s)
+ construct l == (s := set(); for x in l repeat insert!(x,s); s)
count(x:S, s:%) == (member?(x, s) => 1; 0)
subset?(s, t) == #s < #t and (and/[member?(x, t) for x in parts s])
@@ -725,23 +725,23 @@ FiniteSetAggregate(S:SetCategory): Category ==
intersect(s, t) ==
i := {}
- for x in parts s | member?(x, t) repeat insert_!(x, i)
+ for x in parts s | member?(x, t) repeat insert!(x, i)
i
difference(s:%, t:%) ==
m := copy s
- for x in parts t repeat remove_!(x, m)
+ for x in parts t repeat remove!(x, m)
m
symmetricDifference(s, t) ==
d := copy s
for x in parts t repeat
- if member?(x, s) then remove_!(x, d) else insert_!(x, d)
+ if member?(x, s) then remove!(x, d) else insert!(x, d)
d
union(s:%, t:%) ==
u := copy s
- for x in parts t repeat insert_!(x, u)
+ for x in parts t repeat insert!(x, u)
u
if S has Finite then
@@ -846,7 +846,7 @@ KeyedDictionary(Key:SetCategory, Entry:SetCategory): Category ==
keys: % -> List Key
++ keys(t) returns the list the keys in table t.
-- to become keys: % -> Key* and keys: % -> Iterator(Entry,Entry)
- remove_!: (Key, %) -> Union(Entry,"failed")
+ remove!: (Key, %) -> Union(Entry,"failed")
++ remove!(k,t) searches the table t for the key k removing
++ (and return) the entry if there.
++ If t has no such key, \axiom{remove!(k,t)} returns "failed".
@@ -936,7 +936,7 @@ EltableAggregate(Dom:SetCategory, Im:Type): Category ==
++ assuming x is in the domain of u.
++ Error: if x is not in the domain of u.
-- this function will soon be renamed as setelt!.
- qsetelt_!: (%, Dom, Im) -> Im
+ qsetelt!: (%, Dom, Im) -> Im
++ qsetelt!(u,x,y) sets the image of \axiom{x} to be \axiom{y} under
++ \axiom{u}, without checking that \axiom{x} is in the domain of
++ \axiom{u}.
@@ -944,7 +944,7 @@ EltableAggregate(Dom:SetCategory, Im:Type): Category ==
add
qelt(a, x) == elt(a, x)
if % has shallowlyMutable then
- qsetelt_!(a, x, y) == (a.x := y)
+ qsetelt!(a, x, y) == (a.x := y)
@
@@ -1006,10 +1006,10 @@ IndexedAggregate(Index: SetCategory, Entry: Type): Category ==
++ Error: if u is empty.
if % has shallowlyMutable then
- fill_!: (%,Entry) -> %
+ fill!: (%,Entry) -> %
++ fill!(u,x) replaces each entry in aggregate u by x.
++ The modified u is returned as value.
- swap_!: (%,Index,Index) -> Void
+ swap!: (%,Index,Index) -> Void
++ swap!(u,i,j) interchanges elements i and j of aggregate u.
++ No meaningful value is returned.
add
@@ -1026,20 +1026,20 @@ IndexedAggregate(Index: SetCategory, Entry: Type): Category ==
first a == a minIndex a
if % has shallowlyMutable then
- map(f, a) == map_!(f, copy a)
+ map(f, a) == map!(f, copy a)
- map_!(f, a) ==
- for i in indices a repeat qsetelt_!(a, i, f qelt(a, i))
+ map!(f, a) ==
+ for i in indices a repeat qsetelt!(a, i, f qelt(a, i))
a
- fill_!(a, x) ==
- for i in indices a repeat qsetelt_!(a, i, x)
+ fill!(a, x) ==
+ for i in indices a repeat qsetelt!(a, i, x)
a
- swap_!(a, i, j) ==
+ swap!(a, i, j) ==
t := a.i
- qsetelt_!(a, i, a.j)
- qsetelt_!(a, j, t)
+ qsetelt!(a, i, a.j)
+ qsetelt!(a, j, t)
void
@
@@ -1068,7 +1068,7 @@ import List
++ mapping from keys to entries.
TableAggregate(Key:SetCategory, Entry:SetCategory): Category ==
Join(KeyedDictionary(Key,Entry),IndexedAggregate(Key,Entry)) with
- setelt: (%,Key,Entry) -> Entry -- setelt_! later
+ setelt: (%,Key,Entry) -> Entry -- setelt! later
++ setelt(t,k,e) (also written \axiom{t.k := e}) is equivalent
++ to \axiom{(insert([k,e],t); e)}.
table: () -> %
@@ -1086,7 +1086,7 @@ TableAggregate(Key:SetCategory, Entry:SetCategory): Category ==
table l == dictionary l
-- empty() == dictionary()
- insert_!(p, t) == (t(p.key) := p.entry; t)
+ insert!(p, t) == (t(p.key) := p.entry; t)
indices t == keys t
coerce(t:%):OutputForm ==
@@ -1101,7 +1101,7 @@ TableAggregate(Key:SetCategory, Entry:SetCategory): Category ==
(r := search(k, t)) case Entry => r::Entry
e
- map_!(f: Entry->Entry, t: %) ==
+ map!(f: Entry->Entry, t: %) ==
for k in keys t repeat t.k := f t.k
t
@@ -1135,10 +1135,10 @@ TableAggregate(Key:SetCategory, Entry:SetCategory): Category ==
ke: Record(key:Key,entry:Entry) := f [k, t.k]
z ke.key := ke.entry
z
- map_!(f: Record(key:Key,entry:Entry)->Record(key:Key,entry:Entry), t: %): % ==
+ map!(f: Record(key:Key,entry:Entry)->Record(key:Key,entry:Entry), t: %): % ==
lke: List Record(key:Key,entry:Entry) := nil()
for k in keys t repeat
- lke := cons(f [k, remove_!(k,t)::Entry], lke)
+ lke := cons(f [k, remove!(k,t)::Entry], lke)
for ke in lke repeat
t ke.key := ke.entry
t
@@ -1155,12 +1155,12 @@ TableAggregate(Key:SetCategory, Entry:SetCategory): Category ==
index?(k: Key, t: %): Boolean ==
search(k,t) case Entry
- remove_!(x:Record(key:Key,entry:Entry), t:%) ==
- if member?(x, t) then remove_!(x.key, t)
+ remove!(x:Record(key:Key,entry:Entry), t:%) ==
+ if member?(x, t) then remove!(x.key, t)
t
- extract_!(t: %): Record(key:Key,entry:Entry) ==
+ extract!(t: %): Record(key:Key,entry:Entry) ==
k: Record(key:Key,entry:Entry) := inspect t
- remove_!(k.key, t)
+ remove!(k.key, t)
k
any?(f: Entry->Boolean, t: %): Boolean ==
@@ -1230,18 +1230,18 @@ RecursiveAggregate(S:Type): Category == HomogeneousAggregate(S) with
++ node?(u,v) tests if node u is contained in node v
++ (either as a child, a child of a child, etc.).
if % has shallowlyMutable then
- setchildren_!: (%,List %)->%
+ setchildren!: (%,List %)->%
++ setchildren!(u,v) replaces the current children of node u
++ with the members of v in left-to-right order.
setelt: (%,"value",S) -> S
++ setelt(a,"value",x) (also written \axiom{a . value := x})
++ is equivalent to \axiom{setvalue!(a,x)}
- setvalue_!: (%,S) -> S
+ setvalue!: (%,S) -> S
++ setvalue!(u,x) sets the value of node u to x.
add
elt(x,"value") == value x
if % has shallowlyMutable then
- setelt(x,"value",y) == setvalue_!(x,y)
+ setelt(x,"value",y) == setvalue!(x,y)
if S has SetCategory then
child?(x,l) == member?(x,children(l))
@@ -1281,12 +1281,12 @@ BinaryRecursiveAggregate(S:Type):Category == RecursiveAggregate S with
setelt: (%,"left",%) -> %
++ setelt(a,"left",b) (also written \axiom{a . left := b}) is equivalent
++ to \axiom{setleft!(a,b)}.
- setleft_!: (%,%) -> %
+ setleft!: (%,%) -> %
++ setleft!(a,b) sets the left child of \axiom{a} to be b.
setelt: (%,"right",%) -> %
++ setelt(a,"right",b) (also written \axiom{b . right := b})
++ is equivalent to \axiom{setright!(a,b)}.
- setright_!: (%,%) -> %
+ setright!: (%,%) -> %
++ setright!(a,x) sets the right child of t to be x.
add
cycleMax ==> 1000
@@ -1361,8 +1361,8 @@ BinaryRecursiveAggregate(S:Type):Category == RecursiveAggregate S with
for x in l repeat eq?(x,y) => return true
false
if % has shallowlyMutable then
- setelt(x,"left",b) == setleft_!(x,b)
- setelt(x,"right",b) == setright_!(x,b)
+ setelt(x,"left",b) == setleft!(x,b)
+ setelt(x,"right",b) == setright!(x,b)
@
@@ -1407,11 +1407,11 @@ DoublyLinkedAggregate(S:Type): Category == RecursiveAggregate S with
++ Error: if l has no next element.
++ Note: \axiom{next(l) = rest(l)} and \axiom{previous(next(l)) = l}.
if % has shallowlyMutable then
- concat_!: (%,%) -> %
+ concat!: (%,%) -> %
++ concat!(u,v) destructively concatenates doubly-linked aggregate v to the end of doubly-linked aggregate u.
- setprevious_!: (%,%) -> %
+ setprevious!: (%,%) -> %
++ setprevious!(u,v) destructively sets the previous node of doubly-linked aggregate u to v, returning v.
- setnext_!: (%,%) -> %
+ setnext!: (%,%) -> %
++ setnext!(u,v) destructively sets the next node of doubly-linked aggregate u to v, returning v.
@
@@ -1497,34 +1497,34 @@ UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with
++ cycleTail(u) returns the last node in the cycle, or
++ empty if none exists.
if % has shallowlyMutable then
- concat_!: (%,%) -> %
+ concat!: (%,%) -> %
++ concat!(u,v) destructively concatenates v to the end of u.
- ++ Note: \axiom{concat!(u,v) = setlast_!(u,v)}.
- concat_!: (%,S) -> %
+ ++ Note: \axiom{concat!(u,v) = setlast!(u,v)}.
+ concat!: (%,S) -> %
++ concat!(u,x) destructively adds element x to the end of u.
++ Note: \axiom{concat!(a,x) = setlast!(a,[x])}.
- cycleSplit_!: % -> %
+ cycleSplit!: % -> %
++ cycleSplit!(u) splits the aggregate by dropping off the cycle.
++ The value returned is the cycle entry, or nil if none exists.
++ For example, if \axiom{w = concat(u,v)} is the cyclic list where v is
++ the head of the cycle, \axiom{cycleSplit!(w)} will drop v off w thus
++ destructively changing w to u, and returning v.
- setfirst_!: (%,S) -> S
+ setfirst!: (%,S) -> S
++ setfirst!(u,x) destructively changes the first element of a to x.
setelt: (%,"first",S) -> S
++ setelt(u,"first",x) (also written: \axiom{u.first := x}) is
++ equivalent to \axiom{setfirst!(u,x)}.
- setrest_!: (%,%) -> %
+ setrest!: (%,%) -> %
++ setrest!(u,v) destructively changes the rest of u to v.
setelt: (%,"rest",%) -> %
++ setelt(u,"rest",v) (also written: \axiom{u.rest := v}) is equivalent to
++ \axiom{setrest!(u,v)}.
- setlast_!: (%,S) -> S
+ setlast!: (%,S) -> S
++ setlast!(u,x) destructively changes the last element of u to x.
setelt: (%,"last",S) -> S
++ setelt(u,"last",x) (also written: \axiom{u.last := b})
++ is equivalent to \axiom{setlast!(u,v)}.
- split_!: (%,Integer) -> %
+ split!: (%,Integer) -> %
++ split!(u,n) splits u into two aggregates: \axiom{v = rest(u,n)}
++ and \axiom{w = first(u,n)}, returning \axiom{v}.
++ Note: afterwards \axiom{rest(u,n)} returns \axiom{empty()}.
@@ -1546,7 +1546,7 @@ UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with
while not empty? x repeat
l := concat(x, l)
x := rest x
- reverse_! l
+ reverse! l
children x ==
l := empty()$List(%)
@@ -1654,34 +1654,34 @@ UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with
u=v
if % has shallowlyMutable then
- setelt(x, "first", a) == setfirst_!(x, a)
- setelt(x, "last", a) == setlast_!(x, a)
- setelt(x, "rest", a) == setrest_!(x, a)
- concat(x:%, y:%) == concat_!(copy x, y)
+ setelt(x, "first", a) == setfirst!(x, a)
+ setelt(x, "last", a) == setlast!(x, a)
+ setelt(x, "rest", a) == setrest!(x, a)
+ concat(x:%, y:%) == concat!(copy x, y)
- setlast_!(x, s) ==
+ setlast!(x, s) ==
empty? x => error "setlast: empty list"
- setfirst_!(tail x, s)
+ setfirst!(tail x, s)
s
- setchildren_!(u,lv) ==
- #lv=1 => setrest_!(u, first lv)
+ setchildren!(u,lv) ==
+ #lv=1 => setrest!(u, first lv)
error "wrong number of children specified"
- setvalue_!(u,s) == setfirst_!(u,s)
+ setvalue!(u,s) == setfirst!(u,s)
- split_!(p, n) ==
+ split!(p, n) ==
n < 1 => error "index out of range"
p := rest(p, (n - 1)::NonNegativeInteger)
q := rest p
- setrest_!(p, empty())
+ setrest!(p, empty())
q
- cycleSplit_! x ==
+ cycleSplit! x ==
empty?(y := cycleEntry x) or eq?(x, y) => y
z := rest x
while not eq?(z, y) repeat (x := z; z := rest z)
- setrest_!(x, empty())
+ setrest!(x, empty())
y
@
@@ -1744,28 +1744,28 @@ StreamAggregate(S:Type): Category ==
first(rest(x, l::NonNegativeInteger), (h - l + 1)::NonNegativeInteger)
if % has shallowlyMutable then
- concat(x:%, y:%) == concat_!(copy x, y)
+ concat(x:%, y:%) == concat!(copy x, y)
concat l ==
empty? l => empty()
- concat_!(copy first l, concat rest l)
+ concat!(copy first l, concat rest l)
- map_!(f, l) ==
+ map!(f, l) ==
y := l
while not empty? l repeat
- setfirst_!(l, f first l)
+ setfirst!(l, f first l)
l := rest l
y
- fill_!(x, s) ==
+ fill!(x, s) ==
y := x
- while not empty? y repeat (setfirst_!(y, s); y := rest y)
+ while not empty? y repeat (setfirst!(y, s); y := rest y)
x
setelt(x:%, i:Integer, s:S) ==
i := i - minIndex x
(i < 0) or empty?(x := rest(x,i::NonNegativeInteger)) => error "index out of range"
- setfirst_!(x, s)
+ setfirst!(x, s)
setelt(x:%, i:UniversalSegment(Integer), s:S) ==
(l := lo(i) - minIndex x) < 0 => error "index out of range"
@@ -1773,12 +1773,12 @@ StreamAggregate(S:Type): Category ==
h < l => s
y := rest(x, l::NonNegativeInteger)
z := rest(y, (h - l + 1)::NonNegativeInteger)
- while not eq?(y, z) repeat (setfirst_!(y, s); y := rest y)
+ while not eq?(y, z) repeat (setfirst!(y, s); y := rest y)
s
- concat_!(x:%, y:%) ==
+ concat!(x:%, y:%) ==
empty? x => y
- setrest_!(tail x, y)
+ setrest!(tail x, y)
x
@
@@ -1871,7 +1871,7 @@ LinearAggregate(S:Type): Category ==
if % has finiteAggregate then
maxIndex l == #l - 1 + minIndex l
---if % has shallowlyMutable then new(n, s) == fill_!(new n, s)
+--if % has shallowlyMutable then new(n, s) == fill!(new n, s)
@
@@ -1937,14 +1937,14 @@ FiniteLinearAggregate(S:Type): Category == LinearAggregate S with
sorted?: % -> Boolean
++ sorted?(u) tests if the elements of u are in ascending order.
if % has shallowlyMutable then
- copyInto_!: (%,%,Integer) -> %
+ copyInto!: (%,%,Integer) -> %
++ copyInto!(u,v,i) returns aggregate u containing a copy of
++ v inserted at element i.
- reverse_!: % -> %
+ reverse!: % -> %
++ reverse!(u) returns u with its elements in reverse order.
- sort_!: ((S,S)->Boolean,%) -> %
+ sort!: ((S,S)->Boolean,%) -> %
++ sort!(p,u) returns u with its elements ordered by p.
- if S has OrderedSet then sort_!: % -> %
+ if S has OrderedSet then sort!: % -> %
++ sort!(u) returns u with its elements in ascending order.
add
if S has SetCategory then
@@ -1957,11 +1957,11 @@ FiniteLinearAggregate(S:Type): Category == LinearAggregate S with
sort l == sort(_<$S, l)
if % has shallowlyMutable then
- reverse x == reverse_! copy x
- sort(f, l) == sort_!(f, copy l)
+ reverse x == reverse! copy x
+ sort(f, l) == sort!(f, copy l)
if S has OrderedSet then
- sort_! l == sort_!(_<$S, l)
+ sort! l == sort!(_<$S, l)
@
@@ -1998,7 +1998,7 @@ OneDimensionalArrayAggregate(S:Type): Category ==
FiniteLinearAggregate S with shallowlyMutable
add
parts x == [qelt(x, i) for i in minIndex x .. maxIndex x]
- sort_!(f, a) == quickSort(f, a)$FiniteLinearAggregateSort(S, %)
+ sort!(f, a) == quickSort(f, a)$FiniteLinearAggregateSort(S, %)
any?(f, a) ==
for i in minIndex a .. maxIndex a repeat
@@ -2026,15 +2026,15 @@ OneDimensionalArrayAggregate(S:Type): Category ==
if f(qelt(a, i)) then n := n+1
n
- map_!(f, a) ==
+ map!(f, a) ==
for i in minIndex a .. maxIndex a repeat
- qsetelt_!(a, i, f qelt(a, i))
+ qsetelt!(a, i, f qelt(a, i))
a
setelt(a:%, s:UniversalSegment(Integer), x:S) ==
l := lo s; h := if hasHi s then hi s else maxIndex a
l < minIndex a or h > maxIndex a => error "index out of range"
- for k in l..h repeat qsetelt_!(a, k, x)
+ for k in l..h repeat qsetelt!(a, k, x)
x
reduce(f, a) ==
@@ -2073,7 +2073,7 @@ OneDimensionalArrayAggregate(S:Type): Category ==
l := max(0, n - m + 1)::NonNegativeInteger
c := stupidnew(l, a, b)
for i in minIndex(c).. for j in m..n repeat
- qsetelt_!(c, i, f(qelt(a, j), qelt(b, j)))
+ qsetelt!(c, i, f(qelt(a, j), qelt(b, j)))
c
-- map(f, a, b, x) ==
@@ -2082,7 +2082,7 @@ OneDimensionalArrayAggregate(S:Type): Category ==
-- l := (n - m + 1)::NonNegativeInteger
-- c := new l
-- for i in minIndex(c).. for j in m..n repeat
--- qsetelt_!(c, i, f(a(j, x), b(j, x)))
+-- qsetelt!(c, i, f(a(j, x), b(j, x)))
-- c
merge(f, a, b) ==
@@ -2094,13 +2094,13 @@ OneDimensionalArrayAggregate(S:Type): Category ==
k : Integer
for k in minIndex(r).. while i <= m and j <= n repeat
if f(qelt(a, i), qelt(b, j)) then
- qsetelt_!(r, k, qelt(a, i))
+ qsetelt!(r, k, qelt(a, i))
i := i+1
else
- qsetelt_!(r, k, qelt(b, j))
+ qsetelt!(r, k, qelt(b, j))
j := j+1
- for k in k.. for i in i..m repeat qsetelt_!(r, k, elt(a, i))
- for k in k.. for j in j..n repeat qsetelt_!(r, k, elt(b, j))
+ for k in k.. for i in i..m repeat qsetelt!(r, k, elt(a, i))
+ for k in k.. for j in j..n repeat qsetelt!(r, k, elt(b, j))
r
elt(a:%, s:UniversalSegment(Integer)) ==
@@ -2109,7 +2109,7 @@ OneDimensionalArrayAggregate(S:Type): Category ==
l < minIndex a or h > maxIndex a => error "index out of range"
r := stupidnew(max(0, h - l + 1)::NonNegativeInteger, a, a)
for k in minIndex r.. for i in l..h repeat
- qsetelt_!(r, k, qelt(a, i))
+ qsetelt!(r, k, qelt(a, i))
r
insert(a:%, b:%, i:Integer) ==
@@ -2119,30 +2119,30 @@ OneDimensionalArrayAggregate(S:Type): Category ==
y := stupidnew(#a + #b, a, b)
k : Integer
for k in minIndex y.. for j in m..i-1 repeat
- qsetelt_!(y, k, qelt(b, j))
+ qsetelt!(y, k, qelt(b, j))
for k in k.. for j in minIndex a .. maxIndex a repeat
- qsetelt_!(y, k, qelt(a, j))
- for k in k.. for j in i..n repeat qsetelt_!(y, k, qelt(b, j))
+ qsetelt!(y, k, qelt(a, j))
+ for k in k.. for j in i..n repeat qsetelt!(y, k, qelt(b, j))
y
copy x ==
y := stupidnew(#x, x, x)
for i in minIndex x .. maxIndex x for j in minIndex y .. repeat
- qsetelt_!(y, j, qelt(x, i))
+ qsetelt!(y, j, qelt(x, i))
y
- copyInto_!(y, x, s) ==
+ copyInto!(y, x, s) ==
s < minIndex y or s + #x > maxIndex y + 1 =>
error "index out of range"
for i in minIndex x .. maxIndex x for j in s.. repeat
- qsetelt_!(y, j, qelt(x, i))
+ qsetelt!(y, j, qelt(x, i))
y
construct l ==
-- a := new(#l)
empty? l => empty()
a := new(#l, first l)
- for i in minIndex(a).. for x in l repeat qsetelt_!(a, i, x)
+ for i in minIndex(a).. for x in l repeat qsetelt!(a, i, x)
a
delete(a:%, s:UniversalSegment(Integer)) ==
@@ -2152,9 +2152,9 @@ OneDimensionalArrayAggregate(S:Type): Category ==
r := stupidnew((#a - h + l - 1)::NonNegativeInteger, a, a)
k : Integer
for k in minIndex(r).. for i in minIndex a..l-1 repeat
- qsetelt_!(r, k, qelt(a, i))
+ qsetelt!(r, k, qelt(a, i))
for k in k.. for i in h+1 .. maxIndex a repeat
- qsetelt_!(r, k, qelt(a, i))
+ qsetelt!(r, k, qelt(a, i))
r
delete(x:%, i:Integer) ==
@@ -2162,15 +2162,15 @@ OneDimensionalArrayAggregate(S:Type): Category ==
y := stupidnew((#x - 1)::NonNegativeInteger, x, x)
i : Integer
for i in minIndex(y).. for j in minIndex x..i-1 repeat
- qsetelt_!(y, i, qelt(x, j))
+ qsetelt!(y, i, qelt(x, j))
for i in i .. for j in i+1 .. maxIndex x repeat
- qsetelt_!(y, i, qelt(x, j))
+ qsetelt!(y, i, qelt(x, j))
y
- reverse_! x ==
+ reverse! x ==
m := minIndex x
n := maxIndex x
- for i in 0..((n-m) quo 2) repeat swap_!(x, m+i, n-i)
+ for i in 0..((n-m) quo 2) repeat swap!(x, m+i, n-i)
x
concat l ==
@@ -2178,7 +2178,7 @@ OneDimensionalArrayAggregate(S:Type): Category ==
n := +/[#a for a in l]
i := minIndex(r := new(n, stupidget l))
for a in l repeat
- copyInto_!(r, a, i)
+ copyInto!(r, a, i)
i := i + #a
r
@@ -2189,8 +2189,8 @@ OneDimensionalArrayAggregate(S:Type): Category ==
concat(x:%, y:%) ==
z := stupidnew(#x + #y, x, y)
- copyInto_!(z, x, i := minIndex z)
- copyInto_!(z, y, i + #x)
+ copyInto!(z, x, i := minIndex z)
+ copyInto!(z, y, i + #x)
z
if S has CoercibleTo(OutputForm) then
@@ -2248,51 +2248,51 @@ import Integer
++ See \spadtype{FlexibleArray} for an exception.
ExtensibleLinearAggregate(S:Type):Category == LinearAggregate S with
shallowlyMutable
- concat_!: (%,S) -> %
+ concat!: (%,S) -> %
++ concat!(u,x) destructively adds element x to the end of u.
- concat_!: (%,%) -> %
+ concat!: (%,%) -> %
++ concat!(u,v) destructively appends v to the end of u.
++ v is unchanged
- delete_!: (%,Integer) -> %
+ delete!: (%,Integer) -> %
++ delete!(u,i) destructively deletes the \axiom{i}th element of u.
- delete_!: (%,UniversalSegment(Integer)) -> %
+ delete!: (%,UniversalSegment(Integer)) -> %
++ delete!(u,i..j) destructively deletes elements u.i through u.j.
- remove_!: (S->Boolean,%) -> %
+ remove!: (S->Boolean,%) -> %
++ remove!(p,u) destructively removes all elements x of
++ u such that \axiom{p(x)} is true.
- insert_!: (S,%,Integer) -> %
+ insert!: (S,%,Integer) -> %
++ insert!(x,u,i) destructively inserts x into u at position i.
- insert_!: (%,%,Integer) -> %
+ insert!: (%,%,Integer) -> %
++ insert!(v,u,i) destructively inserts aggregate v into u at position i.
- merge_!: ((S,S)->Boolean,%,%) -> %
+ merge!: ((S,S)->Boolean,%,%) -> %
++ merge!(p,u,v) destructively merges u and v using predicate p.
- select_!: (S->Boolean,%) -> %
+ select!: (S->Boolean,%) -> %
++ select!(p,u) destructively changes u by keeping only values x such that
++ \axiom{p(x)}.
if S has SetCategory then
- remove_!: (S,%) -> %
+ remove!: (S,%) -> %
++ remove!(x,u) destructively removes all values x from u.
- removeDuplicates_!: % -> %
+ removeDuplicates!: % -> %
++ removeDuplicates!(u) destructively removes duplicates from u.
- if S has OrderedSet then merge_!: (%,%) -> %
+ if S has OrderedSet then merge!: (%,%) -> %
++ merge!(u,v) destructively merges u and v in ascending order.
add
- delete(x:%, i:Integer) == delete_!(copy x, i)
- delete(x:%, i:UniversalSegment(Integer)) == delete_!(copy x, i)
- remove(f:S -> Boolean, x:%) == remove_!(f, copy x)
- insert(s:S, x:%, i:Integer) == insert_!(s, copy x, i)
- insert(w:%, x:%, i:Integer) == insert_!(copy w, copy x, i)
- select(f, x) == select_!(f, copy x)
- concat(x:%, y:%) == concat_!(copy x, y)
- concat(x:%, y:S) == concat_!(copy x, new(1, y))
- concat_!(x:%, y:S) == concat_!(x, new(1, y))
+ delete(x:%, i:Integer) == delete!(copy x, i)
+ delete(x:%, i:UniversalSegment(Integer)) == delete!(copy x, i)
+ remove(f:S -> Boolean, x:%) == remove!(f, copy x)
+ insert(s:S, x:%, i:Integer) == insert!(s, copy x, i)
+ insert(w:%, x:%, i:Integer) == insert!(copy w, copy x, i)
+ select(f, x) == select!(f, copy x)
+ concat(x:%, y:%) == concat!(copy x, y)
+ concat(x:%, y:S) == concat!(copy x, new(1, y))
+ concat!(x:%, y:S) == concat!(x, new(1, y))
if S has SetCategory then
- remove(s:S, x:%) == remove_!(s, copy x)
- remove_!(s:S, x:%) == remove_!(#1 = s, x)
- removeDuplicates(x:%) == removeDuplicates_!(copy x)
+ remove(s:S, x:%) == remove!(s, copy x)
+ remove!(s:S, x:%) == remove!(#1 = s, x)
+ removeDuplicates(x:%) == removeDuplicates!(copy x)
if S has OrderedSet then
- merge_!(x, y) == merge_!(_<$S, x, y)
+ merge!(x, y) == merge!(_<$S, x, y)
@
@@ -2327,24 +2327,24 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
mergeSort: ((S, S) -> Boolean, %, Integer) -> %
- sort_!(f, l) == mergeSort(f, l, #l)
+ sort!(f, l) == mergeSort(f, l, #l)
list x == concat(x, empty())
reduce(f, x) ==
empty? x => error "reducing over an empty list needs the 3 argument form"
reduce(f, rest x, first x)
- merge(f, p, q) == merge_!(f, copy p, copy q)
+ merge(f, p, q) == merge!(f, copy p, copy q)
- select_!(f, x) ==
+ select!(f, x) ==
while not empty? x and not f first x repeat x := rest x
empty? x => x
y := x
z := rest y
while not empty? z repeat
if f first z then (y := z; z := rest z)
- else (z := rest z; setrest_!(y, z))
+ else (z := rest z; setrest!(y, z))
x
- merge_!(f, p, q) ==
+ merge!(f, p, q) ==
empty? p => q
empty? q => p
eq?(p, q) => error "cannot merge a list into itself"
@@ -2353,52 +2353,52 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
else (r := t := q; q := rest q)
while not empty? p and not empty? q repeat
if f(first p, first q)
- then (setrest_!(t, p); t := p; p := rest p)
- else (setrest_!(t, q); t := q; q := rest q)
- setrest_!(t, if empty? p then q else p)
+ then (setrest!(t, p); t := p; p := rest p)
+ else (setrest!(t, q); t := q; q := rest q)
+ setrest!(t, if empty? p then q else p)
r
- insert_!(s:S, x:%, i:Integer) ==
+ insert!(s:S, x:%, i:Integer) ==
i < (m := minIndex x) => error "index out of range"
i = m => concat(s, x)
y := rest(x, (i - 1 - m)::NonNegativeInteger)
z := rest y
- setrest_!(y, concat(s, z))
+ setrest!(y, concat(s, z))
x
- insert_!(w:%, x:%, i:Integer) ==
+ insert!(w:%, x:%, i:Integer) ==
i < (m := minIndex x) => error "index out of range"
- i = m => concat_!(w, x)
+ i = m => concat!(w, x)
y := rest(x, (i - 1 - m)::NonNegativeInteger)
z := rest y
- setrest_!(y, w)
- concat_!(y, z)
+ setrest!(y, w)
+ concat!(y, z)
x
- remove_!(f:S -> Boolean, x:%) ==
+ remove!(f:S -> Boolean, x:%) ==
while not empty? x and f first x repeat x := rest x
empty? x => x
p := x
q := rest x
while not empty? q repeat
- if f first q then q := setrest_!(p, rest q)
+ if f first q then q := setrest!(p, rest q)
else (p := q; q := rest q)
x
- delete_!(x:%, i:Integer) ==
+ delete!(x:%, i:Integer) ==
i < (m := minIndex x) => error "index out of range"
i = m => rest x
y := rest(x, (i - 1 - m)::NonNegativeInteger)
- setrest_!(y, rest(y, 2))
+ setrest!(y, rest(y, 2))
x
- delete_!(x:%, i:UniversalSegment(Integer)) ==
+ delete!(x:%, i:UniversalSegment(Integer)) ==
(l := lo i) < (m := minIndex x) => error "index out of range"
h := if hasHi i then hi i else maxIndex x
h < l => x
l = m => rest(x, (h + 1 - m)::NonNegativeInteger)
t := rest(x, (l - 1 - m)::NonNegativeInteger)
- setrest_!(t, rest(t, (h - l + 2)::NonNegativeInteger))
+ setrest!(t, rest(t, (h - l + 2)::NonNegativeInteger))
x
find(f, x) ==
@@ -2414,13 +2414,13 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
k
mergeSort(f, p, n) ==
- if n = 2 and f(first rest p, first p) then p := reverse_! p
+ if n = 2 and f(first rest p, first p) then p := reverse! p
n < 3 => p
l := (n quo 2)::NonNegativeInteger
- q := split_!(p, l)
+ q := split!(p, l)
p := mergeSort(f, p, l)
q := mergeSort(f, q, n - l)
- merge_!(f, p, q)
+ merge!(f, p, q)
sorted?(f, l) ==
empty? l => true
@@ -2454,7 +2454,7 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
z := concat(f(first x, first y), z)
x := rest x
y := rest y
- reverse_! z
+ reverse! z
-- map(f, x, y, d) ==
-- z := empty()
@@ -2464,18 +2464,18 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
-- y := rest y
-- z := reverseInPlace z
-- if not empty? x then
--- z := concat_!(z, map(f(#1, d), x))
+-- z := concat!(z, map(f(#1, d), x))
-- if not empty? y then
--- z := concat_!(z, map(f(d, #1), y))
+-- z := concat!(z, map(f(d, #1), y))
-- z
- reverse_! x ==
+ reverse! x ==
empty? x => x
empty?(y := rest x) => x
- setrest_!(x, empty())
+ setrest!(x, empty())
while not empty? y repeat
z := rest y
- setrest_!(y, x)
+ setrest!(y, x)
x := y
y := z
x
@@ -2486,13 +2486,13 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
k = cycleMax and cyclic? x => error "cyclic list"
y := concat(first x, y)
x := rest x
- reverse_! y
+ reverse! y
- copyInto_!(y, x, s) ==
+ copyInto!(y, x, s) ==
s < (m := minIndex y) => error "index out of range"
z := rest(y, (s - m)::NonNegativeInteger)
while not empty? z and not empty? x repeat
- setfirst_!(z, first x)
+ setfirst!(z, first x)
x := rest x
z := rest z
y
@@ -2507,10 +2507,10 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
empty? x => minIndex x - 1
k
- removeDuplicates_! l ==
+ removeDuplicates! l ==
p := l
while not empty? p repeat
- p := setrest_!(p, remove_!(#1 = first p, rest p))
+ p := setrest!(p, remove!(#1 = first p, rest p))
l
if S has OrderedSet then
@@ -2577,12 +2577,12 @@ import Integer
StringAggregate: Category == OneDimensionalArrayAggregate Character with
lowerCase : % -> %
++ lowerCase(s) returns the string with all characters in lower case.
- lowerCase_!: % -> %
+ lowerCase!: % -> %
++ lowerCase!(s) destructively replaces the alphabetic characters
++ in s by lower case.
upperCase : % -> %
++ upperCase(s) returns the string with all characters in upper case.
- upperCase_!: % -> %
+ upperCase!: % -> %
++ upperCase!(s) destructively replaces the alphabetic characters
++ in s by upper case characters.
prefix? : (%, %) -> Boolean
@@ -2654,8 +2654,8 @@ StringAggregate: Category == OneDimensionalArrayAggregate Character with
trim(s: %, c: Character) == leftTrim(rightTrim(s, c), c)
trim(s: %, cc: CharacterClass) == leftTrim(rightTrim(s, cc), cc)
- lowerCase s == lowerCase_! copy s
- upperCase s == upperCase_! copy s
+ lowerCase s == lowerCase! copy s
+ upperCase s == upperCase! copy s
prefix?(s, t) == substring?(s, t, minIndex t)
coerce(c:Character):% == new(1, c)
elt(s:%, t:%): % == concat(s,t)$%
diff --git a/src/algebra/aggcat2.spad.pamphlet b/src/algebra/aggcat2.spad.pamphlet
index de0df1f0..adb212ad 100644
--- a/src/algebra/aggcat2.spad.pamphlet
+++ b/src/algebra/aggcat2.spad.pamphlet
@@ -78,14 +78,14 @@ FiniteLinearAggregateFunctions2(S, A, R, B):
else -- A is a list-oid, B a mutable array-oid
map(f, l) ==
i := minIndex(w := new(#l,getRSample())$B)
- for a in entries l repeat (qsetelt_!(w, i, f a); i := inc i)
+ for a in entries l repeat (qsetelt!(w, i, f a); i := inc i)
w
scan(fn, l, ident) ==
i := minIndex(w := new(#l,getRSample())$B)
vl := ident
for a in entries l repeat
- vl := qsetelt_!(w, i, fn(a, vl))
+ vl := qsetelt!(w, i, fn(a, vl))
i := inc i
w
@@ -105,21 +105,21 @@ FiniteLinearAggregateFunctions2(S, A, R, B):
for i in minIndex v .. maxIndex v repeat
ident := fn(qelt(v, i), ident)
w := concat(ident, w)
- reverse_! w
+ reverse! w
else -- A and B are array-oid's
if B has shallowlyMutable then -- B is also mutable
map(f, v) ==
w := new(#v,getRSample())$B
for i in minIndex w .. maxIndex w repeat
- qsetelt_!(w, i, f qelt(v, i))
+ qsetelt!(w, i, f qelt(v, i))
w
scan(fn, v, ident) ==
w := new(#v,getRSample())$B
vl := ident
for i in minIndex v .. maxIndex v repeat
- vl := qsetelt_!(w, i, fn(qelt(v, i), vl))
+ vl := qsetelt!(w, i, fn(qelt(v, i), vl))
w
else -- B non mutable array-oid
diff --git a/src/algebra/algcat.spad.pamphlet b/src/algebra/algcat.spad.pamphlet
index a9ff5e97..982f6f0a 100644
--- a/src/algebra/algcat.spad.pamphlet
+++ b/src/algebra/algcat.spad.pamphlet
@@ -78,7 +78,7 @@ FiniteRankAlgebra(R:CommutativeRing, UP:UnivariatePolynomialCategory R):
coordinates(v:Vector %, b:Vector %) ==
m := new(#v, #b, 0)$Matrix(R)
for i in minIndex v .. maxIndex v for j in minRowIndex m .. repeat
- setRow_!(m, j, coordinates(qelt(v, i), b))
+ setRow!(m, j, coordinates(qelt(v, i), b))
m
represents(v, b) ==
@@ -160,14 +160,14 @@ FramedAlgebra(R:CommutativeRing, UP:UnivariatePolynomialCategory R):
coordinates(v:Vector %) ==
m := new(#v, rank(), 0)$Matrix(R)
for i in minIndex v .. maxIndex v for j in minRowIndex m .. repeat
- setRow_!(m, j, coordinates qelt(v, i))
+ setRow!(m, j, coordinates qelt(v, i))
m
regularRepresentation x ==
m := new(n := rank(), n, 0)$Matrix(R)
b := basis()
for i in minIndex b .. maxIndex b for j in minRowIndex m .. repeat
- setRow_!(m, j, coordinates(x * qelt(b, i)))
+ setRow!(m, j, coordinates(x * qelt(b, i)))
m
characteristicPolynomial x ==
@@ -184,7 +184,7 @@ FramedAlgebra(R:CommutativeRing, UP:UnivariatePolynomialCategory R):
n:=rank()
m:Matrix R:=zero(n,n+1)
for i in 1..n+1 repeat
- setColumn_!(m,i,coordinates(y))
+ setColumn!(m,i,coordinates(y))
y:=y*x
v:=first nullSpace(m)
+/[monomial(v.(i+1),i) for i in 0..#v-1]
diff --git a/src/algebra/algext.spad.pamphlet b/src/algebra/algext.spad.pamphlet
index 050ccac5..3488e7ba 100644
--- a/src/algebra/algext.spad.pamphlet
+++ b/src/algebra/algext.spad.pamphlet
@@ -104,7 +104,7 @@ SimpleAlgebraicExtension(R:CommutativeRing,
vec : Vector R := new(d,0)
for i in 1..d repeat
xi := qelt(vecQF,i)
- denom(xi) = 1 => qsetelt_!(vec,i,numer xi)
+ denom(xi) = 1 => qsetelt!(vec,i,numer xi)
error "coordinates: coordinates are not integral over ground ring"
vec
@@ -135,7 +135,7 @@ SimpleAlgebraicExtension(R:CommutativeRing,
mr := minRowIndex discmat; mc := minColIndex discmat
for i in 0..d1 repeat
for j in 0..d1 repeat
- qsetelt_!(discmat,mr + i,mc + j,trace reduce monomial(1,i + j))
+ qsetelt!(discmat,mr + i,mc + j,trace reduce monomial(1,i + j))
void
trace x == --this could be coded perhaps more efficiently
diff --git a/src/algebra/algfunc.spad.pamphlet b/src/algebra/algfunc.spad.pamphlet
index 755339b4..0466dbb4 100644
--- a/src/algebra/algfunc.spad.pamphlet
+++ b/src/algebra/algfunc.spad.pamphlet
@@ -150,7 +150,7 @@ AlgebraicallyClosedField(): Category == Join(Field,RadicalCategory) with
else while zero?(p alpha) repeat
p := (p exquo q)::SUP
ans := concat(alpha, ans)
- reverse_! ans
+ reverse! ans
@
\section{category ACFS AlgebraicallyClosedFunctionSpace}
diff --git a/src/algebra/alql.spad.pamphlet b/src/algebra/alql.spad.pamphlet
index 861ceefe..4b704286 100644
--- a/src/algebra/alql.spad.pamphlet
+++ b/src/algebra/alql.spad.pamphlet
@@ -140,7 +140,7 @@ Database(S): Exports == Implementation where
field := variable eq
val := value eq
[x for x in data | stringMatches?(val,x.field)$Lisp]
- x+y==removeDuplicates_! merge(x,y)
+ x+y==removeDuplicates! merge(x,y)
x-y==mergeDifference(copy(x::Rep),y::Rep)$MergeThing(S)
coerce(data): OutputForm == (#data):: OutputForm
display(data) == for x in data repeat display x
diff --git a/src/algebra/array1.spad.pamphlet b/src/algebra/array1.spad.pamphlet
index 00117332..df4c2205 100644
--- a/src/algebra/array1.spad.pamphlet
+++ b/src/algebra/array1.spad.pamphlet
@@ -153,7 +153,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
++ flexibleArray(l) creates a flexible array from the list of elements l
physicalLength : % -> NonNegativeInteger
++ physicalLength(x) returns the number of elements x can accomodate before growing
- physicalLength_!: (%, I) -> %
+ physicalLength!: (%, I) -> %
++ physicalLength!(x,n) changes the physical length of x to be n and returns the new array.
shrinkable: Boolean -> Boolean
++ shrinkable(b) sets the shrinkable attribute of flexible arrays to b and returns the previous value
@@ -167,13 +167,13 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
newa : (N, A) -> A
physicalLength(r) == (r.physLen) pretend NonNegativeInteger
- physicalLength_!(r, n) ==
+ physicalLength!(r, n) ==
r.physLen = 0 => error "flexible array must be non-empty"
growWith(r, n, r.f.0)
empty() == [0, 0, empty()]
#r == (r.logLen)::N
- fill_!(r, x) == (fill_!(r.f, x); r)
+ fill!(r, x) == (fill!(r.f, x); r)
maxIndex r == r.logLen - 1 + mn
minIndex r == mn
new(n, a) == [n, n, new(n, a)]
@@ -249,40 +249,40 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
r.f.(i-mn) := x
-- operations inherited from extensible aggregate
- merge(g, a, b) == merge_!(g, copy a, b)
- concat(x:S, r:%) == insert_!(x, r, mn)
+ merge(g, a, b) == merge!(g, copy a, b)
+ concat(x:S, r:%) == insert!(x, r, mn)
- concat_!(r:%, x:S) ==
+ concat!(r:%, x:S) ==
growAndFill(r, 1, x)
r.f.(r.logLen-1) := x
r
- concat_!(a:%, b:%) ==
+ concat!(a:%, b:%) ==
if eq?(a, b) then b := copy b
n := #a
growAdding(a, #b, b)
- copyInto_!(a, b, n + mn)
+ copyInto!(a, b, n + mn)
- remove_!(g:(S->Boolean), a:%) ==
+ remove!(g:(S->Boolean), a:%) ==
k:I := 0
for i in 0..maxIndex a - mn repeat
if not g(a.i) then (a.k := a.i; k := k+1)
shrink(a, #a - k)
- delete_!(r:%, i1:I) ==
+ delete!(r:%, i1:I) ==
i := i1 - mn
i < 0 or i > r.logLen => error "index out of range"
for k in i..r.logLen-2 repeat r.f.k := r.f.(k+1)
shrink(r, 1)
- delete_!(r:%, i:U) ==
+ delete!(r:%, i:U) ==
l := lo i - mn; m := maxIndex r - mn
h := (hasHi i => hi i - mn; m)
l < 0 or h > m => error "index out of range"
for j in l.. for k in h+1..m repeat r.f.j := r.f.k
shrink(r, max(0,h-l+1))
- insert_!(x:S, r:%, i1:I):% ==
+ insert!(x:S, r:%, i1:I):% ==
i := i1 - mn
n := r.logLen
i < 0 or i > n => error "index out of range"
@@ -291,7 +291,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
r.f.i := x
r
- insert_!(a:%, b:%, i1:I):% ==
+ insert!(a:%, b:%, i1:I):% ==
i := i1 - mn
if eq?(a, b) then b := copy b
m := #a; n := #b
@@ -301,7 +301,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
for k in m-1 .. 0 by -1 repeat b.f.(i+k) := a.f.k
b
- merge_!(g, a, b) ==
+ merge!(g, a, b) ==
m := #a; n := #b; growAdding(a, n, b)
for i in m-1..0 by -1 for j in m+n-1.. by -1 repeat a.f.j := a.f.i
i := n; j := 0
@@ -312,13 +312,13 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
for k in k.. for j in j..n-1 repeat a.f.k := b.f.j
a
- select_!(g:(S->Boolean), a:%) ==
+ select!(g:(S->Boolean), a:%) ==
k:I := 0
for i in 0..maxIndex a - mn repeat if g(a.f.i) then (a.f.k := a.f.i;k := k+1)
shrink(a, #a - k)
if S has SetCategory then
- removeDuplicates_! a ==
+ removeDuplicates! a ==
ct := #a
ct < 2 => a
@@ -332,7 +332,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
j := j+1
nlim := j
i := i+1
- nlim ~= nlim0 => delete_!(a, i..)
+ nlim ~= nlim0 => delete!(a, i..)
a
@
@@ -410,7 +410,7 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
if zero? mn then
qelt(x, i) == Qelt(x, i)
- qsetelt_!(x, i, s) == Qsetelt(x, i, s)
+ qsetelt!(x, i, s) == Qsetelt(x, i, s)
elt(x:%, i:I) ==
negative? i or i > maxIndex(x) => error "index out of range"
@@ -418,12 +418,12 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
setelt(x:%, i:I, s:S) ==
negative? i or i > maxIndex(x) => error "index out of range"
- qsetelt_!(x, i, s)
+ qsetelt!(x, i, s)
else if one? mn then
maxIndex x == Qsize x
qelt(x, i) == Qelt(x, i-1)
- qsetelt_!(x, i, s) == Qsetelt(x, i-1, s)
+ qsetelt!(x, i, s) == Qsetelt(x, i-1, s)
elt(x:%, i:I) ==
QSLESSP(i,1$Lisp)$Lisp or QSLESSP(Qsize x,i)$Lisp =>
@@ -437,7 +437,7 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
else
qelt(x, i) == Qelt(x, i - mn)
- qsetelt_!(x, i, s) == Qsetelt(x, i - mn, s)
+ qsetelt!(x, i, s) == Qsetelt(x, i - mn, s)
elt(x:%, i:I) ==
i < mn or i > maxIndex(x) => error "index out of range"
@@ -445,7 +445,7 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
setelt(x:%, i:I, s:S) ==
i < mn or i > maxIndex(x) => error "index out of range"
- qsetelt_!(x, i, s)
+ qsetelt!(x, i, s)
@
\section{domain ARRAY1 OneDimensionalArray}
diff --git a/src/algebra/array2.spad.pamphlet b/src/algebra/array2.spad.pamphlet
index 5cbff9ce..8daa7b77 100644
--- a/src/algebra/array2.spad.pamphlet
+++ b/src/algebra/array2.spad.pamphlet
@@ -45,7 +45,7 @@ TwoDimensionalArrayCategory(R,Row,Col): Category == Definition where
new: (NonNegativeInteger,NonNegativeInteger,R) -> %
++ new(m,n,r) is an m-by-n array all of whose entries are r
- fill_!: (%,R) -> %
+ fill!: (%,R) -> %
++ fill!(m,r) fills m with r's
--% Size inquiries
@@ -89,24 +89,24 @@ TwoDimensionalArrayCategory(R,Row,Col): Category == Definition where
--% Part assignments
setelt: (%,Integer,Integer,R) -> R
- -- will become setelt_!
+ -- will become setelt!
++ setelt(m,i,j,r) sets the element in the ith row and jth
++ column of m to r
++ error check to determine if indices are in proper ranges
- qsetelt_!: (%,Integer,Integer,R) -> R
+ qsetelt!: (%,Integer,Integer,R) -> R
++ qsetelt!(m,i,j,r) sets the element in the ith row and jth
++ column of m to r
++ NO error check to determine if indices are in proper ranges
- setRow_!: (%,Integer,Row) -> %
+ setRow!: (%,Integer,Row) -> %
++ setRow!(m,i,v) sets to ith row of m to v
- setColumn_!: (%,Integer,Col) -> %
+ setColumn!: (%,Integer,Col) -> %
++ setColumn!(m,j,v) sets to jth column of m to v
--% Map and Zip
map: (R -> R,%) -> %
++ map(f,a) returns \spad{b}, where \spad{b(i,j) = f(a(i,j))} for all \spad{i, j}
- map_!: (R -> R,%) -> %
+ map!: (R -> R,%) -> %
++ map!(f,a) assign \spad{a(i,j)} to \spad{f(a(i,j))} for all \spad{i, j}
map:((R,R) -> R,%,%) -> %
++ map(f,a,b) returns \spad{c}, where \spad{c(i,j) = f(a(i,j),b(i,j))}
@@ -175,26 +175,26 @@ TwoDimensionalArrayCategory(R,Row,Col): Category == Definition where
ans := new(nrows m,ncols m,sampleElement())
for i in minRowIndex(m)..maxRowIndex(m) repeat
for j in minColIndex(m)..maxColIndex(m) repeat
- qsetelt_!(ans,i,j,qelt(m,i,j))
+ qsetelt!(ans,i,j,qelt(m,i,j))
ans
- fill_!(m,r) ==
+ fill!(m,r) ==
for i in minRowIndex(m)..maxRowIndex(m) repeat
for j in minColIndex(m)..maxColIndex(m) repeat
- qsetelt_!(m,i,j,r)
+ qsetelt!(m,i,j,r)
m
map(f,m) ==
ans := new(nrows m,ncols m,sampleElement())
for i in minRowIndex(m)..maxRowIndex(m) repeat
for j in minColIndex(m)..maxColIndex(m) repeat
- qsetelt_!(ans,i,j,f(qelt(m,i,j)))
+ qsetelt!(ans,i,j,f(qelt(m,i,j)))
ans
- map_!(f,m) ==
+ map!(f,m) ==
for i in minRowIndex(m)..maxRowIndex(m) repeat
for j in minColIndex(m)..maxColIndex(m) repeat
- qsetelt_!(m,i,j,f(qelt(m,i,j)))
+ qsetelt!(m,i,j,f(qelt(m,i,j)))
m
map(f,m,n) ==
@@ -203,7 +203,7 @@ TwoDimensionalArrayCategory(R,Row,Col): Category == Definition where
ans := new(nrows m,ncols m,sampleElement())
for i in minRowIndex(m)..maxRowIndex(m) repeat
for j in minColIndex(m)..maxColIndex(m) repeat
- qsetelt_!(ans,i,j,f(qelt(m,i,j),qelt(n,i,j)))
+ qsetelt!(ans,i,j,f(qelt(m,i,j),qelt(n,i,j)))
ans
map(f,m,n,r) ==
@@ -212,23 +212,23 @@ TwoDimensionalArrayCategory(R,Row,Col): Category == Definition where
ans := new(max(nrows m,nrows n),max(ncols m,ncols n),sampleElement())
for i in minRowIndex(m)..maxRow repeat
for j in minColIndex(m)..maxCol repeat
- qsetelt_!(ans,i,j,f(elt(m,i,j,r),elt(n,i,j,r)))
+ qsetelt!(ans,i,j,f(elt(m,i,j,r),elt(n,i,j,r)))
ans
- setRow_!(m,i,v) ==
+ setRow!(m,i,v) ==
i < minRowIndex(m) or i > maxRowIndex(m) =>
error "setRow!: index out of range"
for j in minColIndex(m)..maxColIndex(m) _
for k in minIndex(v)..maxIndex(v) repeat
- qsetelt_!(m,i,j,v.k)
+ qsetelt!(m,i,j,v.k)
m
- setColumn_!(m,j,v) ==
+ setColumn!(m,j,v) ==
j < minColIndex(m) or j > maxColIndex(m) =>
error "setColumn!: index out of range"
for i in minRowIndex(m)..maxRowIndex(m) _
for k in minIndex(v)..maxIndex(v) repeat
- qsetelt_!(m,i,j,v.k)
+ qsetelt!(m,i,j,v.k)
m
if R has _= : (R,R) -> Boolean then
@@ -257,7 +257,7 @@ TwoDimensionalArrayCategory(R,Row,Col): Category == Definition where
v : Row := new(ncols m,sampleElement())
for j in minColIndex(m)..maxColIndex(m) _
for k in minIndex(v)..maxIndex(v) repeat
- qsetelt_!(v,k,qelt(m,i,j))
+ qsetelt!(v,k,qelt(m,i,j))
v
if Col has shallowlyMutable then
@@ -268,7 +268,7 @@ TwoDimensionalArrayCategory(R,Row,Col): Category == Definition where
v : Col := new(nrows m,sampleElement())
for i in minRowIndex(m)..maxRowIndex(m) _
for k in minIndex(v)..maxIndex(v) repeat
- qsetelt_!(v,k,qelt(m,i,j))
+ qsetelt!(v,k,qelt(m,i,j))
v
if R has CoercibleTo(OutputForm) then
@@ -314,7 +314,7 @@ InnerIndexedTwoDimensionalArray(R,mnRow,mnCol,Row,Col):_
-- error "new: arrays with zero columns are not supported"
arr : PrimitiveArray PrimitiveArray R := new(rows,empty())
for i in minIndex(arr)..maxIndex(arr) repeat
- qsetelt_!(arr,i,new(cols,a))
+ qsetelt!(arr,i,new(cols,a))
arr
--% Size inquiries
@@ -342,7 +342,7 @@ InnerIndexedTwoDimensionalArray(R,mnRow,mnCol,Row,Col):_
error "elt: index out of range"
qelt(m,i,j)
- qsetelt_!(m,i,j,r) ==
+ qsetelt!(m,i,j,r) ==
setelt(qelt(m,i - minRowIndex m)$Rep,j - minColIndex m,r)
setelt(m:%,i:Integer,j:Integer,r:R) ==
@@ -350,7 +350,7 @@ InnerIndexedTwoDimensionalArray(R,mnRow,mnCol,Row,Col):_
error "setelt: index out of range"
j < minColIndex(m) or j > maxColIndex(m) =>
error "setelt: index out of range"
- qsetelt_!(m,i,j,r)
+ qsetelt!(m,i,j,r)
if R has SetCategory then
latex(m : %) : String ==
diff --git a/src/algebra/bags.spad.pamphlet b/src/algebra/bags.spad.pamphlet
index 9474a267..c00704a4 100644
--- a/src/algebra/bags.spad.pamphlet
+++ b/src/algebra/bags.spad.pamphlet
@@ -55,18 +55,18 @@ Stack(S: Type): StackAggregate S with
copy s == ref copy deref s
depth s == # deref s
# s == depth s
- pop_! (s:%):S ==
+ pop! (s:%):S ==
empty? s => error "empty stack"
e := first deref s
setref(s,rest deref s)
e
- extract_! (s:%):S == pop_! s
+ extract! (s:%):S == pop! s
top (s:%):S ==
empty? s => error "empty stack"
first deref s
inspect s == top s
- push_!(e,s) == (setref(s,cons(e,deref s));e)
- insert_!(e:S,s:%):% == (push_!(e,s);s)
+ push!(e,s) == (setref(s,cons(e,deref s));e)
+ insert!(e:S,s:%):% == (push!(e,s);s)
empty() == ref nil()$List(S)
empty? s == null deref s
stack s == ref copy s
@@ -108,14 +108,14 @@ ArrayStack(S:SetCategory): StackAggregate(S) with
-- stack operations
depth s == # s
empty? s == empty?(s)$Rep
- extract_! s == pop_! s
- insert_!(e,s) == (push_!(e,s);s)
- push_!(e,s) == (concat(e,s); e)
- pop_! s ==
+ extract! s == pop! s
+ insert!(e,s) == (push!(e,s);s)
+ push!(e,s) == (concat(e,s); e)
+ pop! s ==
if empty? s then error "empty stack"
m := maxIndex s
r := s.m
- delete_!(s,m)
+ delete!(s,m)
r
top s == if empty? s then error "empty stack" else s.maxIndex(s)
arrayStack l == construct(l)$Rep
@@ -147,18 +147,18 @@ Queue(S:SetCategory): QueueAggregate S with
== Stack S add
Rep := Reference List S
lastTail==> LAST$Lisp
- enqueue_!(e,q) ==
+ enqueue!(e,q) ==
if null deref q then setref(q, list e)
else lastTail.(deref q).rest := list e
e
- insert_!(e,q) == (enqueue_!(e,q);q)
- dequeue_! q ==
+ insert!(e,q) == (enqueue!(e,q);q)
+ dequeue! q ==
empty? q => error "empty queue"
e := first deref q
setref(q,rest deref q)
e
- extract_! q == dequeue_! q
- rotate_! q == if empty? q then q else (enqueue_!(dequeue_! q,q); q)
+ extract! q == dequeue! q
+ rotate! q == if empty? q then q else (enqueue!(dequeue! q,q); q)
length q == # deref q
front q == if empty? q then error "empty queue" else first deref q
inspect q == front q
@@ -190,10 +190,10 @@ Dequeue(S:SetCategory): DequeueAggregate S with
++ element x, second element y,...,and last (bottom or back) element z.
== Queue S add
Rep := Reference List S
- bottom_! d ==
+ bottom! d ==
if empty? d then error "empty dequeue" else last deref d
dequeue d == ref copy d
- extractBottom_! d ==
+ extractBottom! d ==
if empty? d then error "empty dequeue"
p := deref d
n := maxIndex p
@@ -205,19 +205,19 @@ Dequeue(S:SetCategory): DequeueAggregate S with
r := first rest q
q.rest := []
r
- extractTop_! d ==
+ extractTop! d ==
e := top d
setref(d,rest deref d)
e
height d == # deref d
- insertTop_!(e,d) == (setref(d,cons(e,deref d)); e)
+ insertTop!(e,d) == (setref(d,cons(e,deref d)); e)
lastTail==> LAST$Lisp
- insertBottom_!(e,d) ==
+ insertBottom!(e,d) ==
if empty? d then setref(d, list e)
else lastTail.(deref d).rest := list e
e
top d == if empty? d then error "empty dequeue" else first deref d
- reverse_! d == (setref(d,reverse deref d); d)
+ reverse! d == (setref(d,reverse deref d); d)
@
\section{domain HEAP Heap}
@@ -251,7 +251,7 @@ Heap(S:OrderedSet): Exports == Implementation where
n := #l
h := empty()
n = 0 => h
- for x in l repeat insert_!(x,h)
+ for x in l repeat insert!(x,h)
h
siftUp: (%,Integer,Integer) -> Void
siftUp(r,i,n) ==
@@ -261,21 +261,21 @@ Heap(S:OrderedSet): Exports == Implementation where
if (k := j+1) < n and r.j < r.k then j := k
if t < r.j then (r.i := r.j; r.j := t; i := j) else leave
- extract_! r ==
+ extract! r ==
-- extract the maximum from the heap O(log n)
n := #r :: Integer
n = 0 => error "empty heap"
t := r(0)
r(0) := r(n-1)
- delete_!(r,n-1)
+ delete!(r,n-1)
n = 1 => t
siftUp(r,0,n-1)
t
- insert_!(x,r) ==
+ insert!(x,r) ==
-- Williams' insertion algorithm O(log n)
j := (#r) :: Integer
- r:=concat_!(r,concat(x,empty()$Rep))
+ r:=concat!(r,concat(x,empty()$Rep))
while j > 0 repeat
i := (j-1) quo 2
if r(i) >= x then leave
@@ -294,7 +294,7 @@ Heap(S:OrderedSet): Exports == Implementation where
r
bag l == makeHeap construct(l)$Rep
merge(a,b) == makeHeap concat(a,b)
- merge_!(a,b) == makeHeap concat_!(a,b)
+ merge!(a,b) == makeHeap concat!(a,b)
@
\section{License}
diff --git a/src/algebra/bezout.spad.pamphlet b/src/algebra/bezout.spad.pamphlet
index 7f6b5400..31bde193 100644
--- a/src/algebra/bezout.spad.pamphlet
+++ b/src/algebra/bezout.spad.pamphlet
@@ -66,13 +66,13 @@ BezoutMatrix(R,UP,M,Row,Col): Exports == Implementation where
coef := lc p0; deg := degree p0; p0 := reductum p0
-- put bk = coef(p,k) in sylmat(minR + i,minC + i + (n1 - k))
for i in 0..n2 - 1 repeat
- qsetelt_!(sylmat,minR + i,minC + n1 - deg + i,coef)
+ qsetelt!(sylmat,minR + i,minC + n1 - deg + i,coef)
q0 := q
-- fill in coefficients of 'q'
while not zero? q0 repeat
coef := lc q0; deg := degree q0; q0 := reductum q0
for i in 0..n1-1 repeat
- qsetelt_!(sylmat,minR + n2 + i,minC + n2 - deg + i,coef)
+ qsetelt!(sylmat,minR + n2 + i,minC + n2 - deg + i,coef)
sylmat
bezoutMatrix(p,q) ==
@@ -96,7 +96,7 @@ BezoutMatrix(R,UP,M,Row,Col): Exports == Implementation where
-- for i = 0...
-- quit when i > m2 or when i + (n1 - k) > m1, whichever happens first
for i in 0..min(m2,deg - 1) repeat
- qsetelt_!(sylmat,minR + i,minC + n1 - deg + i,coef)
+ qsetelt!(sylmat,minR + i,minC + n1 - deg + i,coef)
q0 := q
-- fill in coefficients of 'q'
while not zero? q0 repeat
@@ -106,7 +106,7 @@ BezoutMatrix(R,UP,M,Row,Col): Exports == Implementation where
-- quit when i > m1 or when i + (n2 - k) > m1, whichever happens first
-- since n2 - k >= 0, we quit when i + (n2 - k) > m1
for i in 0..(deg + n1 - n2 - 1) repeat
- qsetelt_!(sylmat,minR + n2 + i,minC + n2 - deg + i,coef)
+ qsetelt!(sylmat,minR + n2 + i,minC + n2 - deg + i,coef)
-- 'bezmat' will be the 'Bezout matrix' as described in Knuth
bezmat : M := new(n1,n1,0)
for i in 0..m2 repeat
@@ -121,7 +121,7 @@ BezoutMatrix(R,UP,M,Row,Col): Exports == Implementation where
for k in minC..maxC repeat
c := coef * qelt(sylmat,minR + m2 - i - deg,k) +
qelt(bezmat,minR + m2 - i,k)
- qsetelt_!(bezmat,minR + m2 - i,k,c)
+ qsetelt!(bezmat,minR + m2 - i,k,c)
q0 := reductum q0
p0 := p
while not zero? p0 repeat
@@ -132,10 +132,10 @@ BezoutMatrix(R,UP,M,Row,Col): Exports == Implementation where
for k in minC..maxC repeat
c := -coef * qelt(sylmat,minR + m - i - deg,k) +
qelt(bezmat,minR + m2 - i,k)
- qsetelt_!(bezmat,minR + m2 - i,k,c)
+ qsetelt!(bezmat,minR + m2 - i,k,c)
p0 := reductum p0
for i in n2..m1 repeat for k in minC..maxC repeat
- qsetelt_!(bezmat,minR + i,k,qelt(sylmat,minR + i,k))
+ qsetelt!(bezmat,minR + i,k,qelt(sylmat,minR + i,k))
bezmat
if R has commutative("*") then
diff --git a/src/algebra/carten.spad.pamphlet b/src/algebra/carten.spad.pamphlet
index 8b00959a..37383bfb 100644
--- a/src/algebra/carten.spad.pamphlet
+++ b/src/algebra/carten.spad.pamphlet
@@ -245,7 +245,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
get ==> elt$Rep
- set_! ==> setelt$Rep
+ set! ==> setelt$Rep
-- Use row-major order:
-- x[h,i,j] <-> x[(h-minix)*dim**2+(i-minix)*dim+(j-minix)]
@@ -310,13 +310,13 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
p
-- permute s according to p into result t.
- permute_!(t: INDEX, s: INDEX, p: PERM): INDEX ==
+ permute!(t: INDEX, s: INDEX, p: PERM): INDEX ==
for i in 1..#p repeat t.i := s.(p.i)
t
-- permsign!(v) = 1, 0, or -1 according as
-- v is an even, is not, or is an odd permutation of minix..minix+#v-1.
- permsign_!(v: INDEX): Integer ==
+ permsign!(v: INDEX): Integer ==
-- sum minix..minix+#v-1.
maxix := minix+#v-1
psum := (((maxix+1)*maxix - minix*(minix-1)) exquo 2)::Integer
@@ -349,19 +349,19 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
nz: NNI := # l
lengthRankOrElse nz
z := new(nz, 0)
- for i in 0..nz-1 for r in l repeat set_!(z, i, r)
+ for i in 0..nz-1 for r in l repeat set!(z, i, r)
z
kroneckerDelta() ==
z := new(dim2, 0)
- for i in 1..dim for zi in 0.. by (dim+1) repeat set_!(z, zi, 1)
+ for i in 1..dim for zi in 0.. by (dim+1) repeat set!(z, zi, 1)
z
leviCivitaSymbol() ==
nz := dim**dim
z := new(nz, 0)
indv: INDEX := new(dim, 0)
for i in 0..nz-1 repeat
- set_!(z, i, permsign_!(int2index(i, indv))::R)
+ set!(z, i, permsign!(int2index(i, indv))::R)
z
-- from GradedModule
@@ -400,7 +400,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
coerce(lr: List R): % ==
#lr ~= dim => error "Incorrect number of components"
z := new(dim, 0)
- for r in lr for i in 0..dim-1 repeat set_!(z, i, r)
+ for r in lr for i in 0..dim-1 repeat set!(z, i, r)
z
coerce(lx: List %): % ==
#lx ~= dim => error "Incorrect number of slices"
@@ -410,7 +410,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
nx := # first lx
z := new(dim * nx, 0)
for x in lx for offz in 0.. by nx repeat
- for i in 0..nx-1 repeat set_!(z, offz + i, get(x,i))
+ for i in 0..nx-1 repeat set!(z, offz + i, get(x,i))
z
retractIfCan(x:%):Union(R,"failed") ==
@@ -441,14 +441,14 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
coerce(v: DP(dim,R)): % ==
z := new(dim, 0)
for i in 0..dim-1 for j in minIndex v .. maxIndex v repeat
- set_!(z, i, v.j)
+ set!(z, i, v.j)
z
coerce(m: SM(dim,R)): % ==
z := new(dim**2, 0)
offz := 0
for i in 0..dim-1 repeat
for j in 0..dim-1 repeat
- set_!(z, offz + j, m(i+1,j+1))
+ set!(z, offz + j, m(i+1,j+1))
offz := offz + dim
z
@@ -461,45 +461,45 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
#x ~= #y => error "Rank mismatch"
-- z := [xi + yi for xi in x for yi in y]
z := new(#x, 0)
- for i in 0..#x-1 repeat set_!(z, i, get(x,i) + get(y,i))
+ for i in 0..#x-1 repeat set!(z, i, get(x,i) + get(y,i))
z
x - y ==
#x ~= #y => error "Rank mismatch"
-- [xi - yi for xi in x for yi in y]
z := new(#x, 0)
- for i in 0..#x-1 repeat set_!(z, i, get(x,i) - get(y,i))
+ for i in 0..#x-1 repeat set!(z, i, get(x,i) - get(y,i))
z
- x ==
-- [-xi for xi in x]
z := new(#x, 0)
- for i in 0..#x-1 repeat set_!(z, i, -get(x,i))
+ for i in 0..#x-1 repeat set!(z, i, -get(x,i))
z
n * x ==
-- [n * xi for xi in x]
z := new(#x, 0)
- for i in 0..#x-1 repeat set_!(z, i, n * get(x,i))
+ for i in 0..#x-1 repeat set!(z, i, n * get(x,i))
z
x * n ==
-- [n * xi for xi in x]
z := new(#x, 0)
- for i in 0..#x-1 repeat set_!(z, i, n* get(x,i)) -- Commutative!!
+ for i in 0..#x-1 repeat set!(z, i, n* get(x,i)) -- Commutative!!
z
r * x ==
-- [r * xi for xi in x]
z := new(#x, 0)
- for i in 0..#x-1 repeat set_!(z, i, r * get(x,i))
+ for i in 0..#x-1 repeat set!(z, i, r * get(x,i))
z
x * r ==
-- [xi*r for xi in x]
z := new(#x, 0)
- for i in 0..#x-1 repeat set_!(z, i, r* get(x,i)) -- Commutative!!
+ for i in 0..#x-1 repeat set!(z, i, r* get(x,i)) -- Commutative!!
z
product(x, y) ==
nx := #x; ny := #y
z := new(nx * ny, 0)
for i in 0..nx-1 for ioff in 0.. by ny repeat
for j in 0..ny-1 repeat
- set_!(z, ioff + j, get(x,i) * get(y,j))
+ set!(z, ioff + j, get(x,i) * get(y,j))
z
x * y ==
rx := rank x
@@ -526,9 +526,9 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
for xm in xh.. by xom for zm in zh.. by zom repeat
for l in 1..nl _
for xl in xm.. by xol for zl in zm.. by zol repeat
- set_!(z, zl, 0)
+ set!(z, zl, 0)
for k in 1..dim for xk in xl.. by xok repeat
- set_!(z, zl, get(z,zl) + get(x,xk))
+ set!(z, zl, get(z,zl) + get(x,xk))
z
contract(x, i, y, j) ==
@@ -556,10 +556,10 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
for yh in 0.. by ohy for zhy in zlx.. by zohy repeat
for dyl in 1..nly _
for yl in yh.. by oly for zly in zhy.. by zoly repeat
- set_!(z, zly, 0)
+ set!(z, zly, 0)
for k in 1..dim _
for xk in xl.. by nlx for yk in yl.. by nly repeat
- set_!(z, zly, get(z,zly)+get(x,xk)*get(y,yk))
+ set!(z, zly, get(z,zly)+get(x,xk)*get(y,yk))
z
transpose x ==
@@ -581,7 +581,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
for zp in zl.. by zoi for xp in zl.. by zoj repeat
for q in 1..dim _
for zq in zp.. by zoj for xq in xp.. by zoi repeat
- set_!(z, zq, get(x,xq))
+ set!(z, zq, get(x,xq))
z
reindex(x, l) ==
@@ -595,8 +595,8 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
-- Use permutation
for i in 0..#x-1 repeat
- pi := index2int(permute_!(ziv, int2index(i,xiv),p))
- set_!(z, pi, get(x,i))
+ pi := index2int(permute!(ziv, int2index(i,xiv),p))
+ set!(z, pi, get(x,i))
z
@
diff --git a/src/algebra/clip.spad.pamphlet b/src/algebra/clip.spad.pamphlet
index 04f9f42a..d74d0d78 100644
--- a/src/algebra/clip.spad.pamphlet
+++ b/src/algebra/clip.spad.pamphlet
@@ -203,7 +203,7 @@ TwoDimensionalPlotClipping(): Exports == Implementation where
lastPt? := true
list := nil()
empty? list => ans
- reverse_! cons(reverse_! list,ans)
+ reverse! cons(reverse! list,ans)
clip(plot,fraction,scale) ==
-- sayBrightly([" clip: "::OutputForm]$List(OutputForm))$Lisp
diff --git a/src/algebra/combinat.spad.pamphlet b/src/algebra/combinat.spad.pamphlet
index a70619fa..67993613 100644
--- a/src/algebra/combinat.spad.pamphlet
+++ b/src/algebra/combinat.spad.pamphlet
@@ -70,7 +70,7 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with
m := #P
n < 0 => error "partition is not defined for negative integers"
n < m::I => P(convert(n)@Z)
- concat_!(P, new((convert(n+1)@Z - m)::N,0)$IndexedFlexibleArray(I,0))
+ concat!(P, new((convert(n+1)@Z - m)::N,0)$IndexedFlexibleArray(I,0))
for i in m..convert(n)@Z repeat
s:I := 1
t:I := 0
diff --git a/src/algebra/contfrac.spad.pamphlet b/src/algebra/contfrac.spad.pamphlet
index 615d435a..89237728 100644
--- a/src/algebra/contfrac.spad.pamphlet
+++ b/src/algebra/contfrac.spad.pamphlet
@@ -218,7 +218,7 @@ ContinuedFraction(R): Exports == Implementation where
l := concat([1,qr.quotient],l)
n := d
d := qr.remainder
- [[wh, construct rest reverse_! l], true]
+ [[wh, construct rest reverse! l], true]
characteristic == characteristic$Q
@@ -331,7 +331,7 @@ ContinuedFraction(R): Exports == Implementation where
l := concat(zagRec frst fr,l)
fr := rst fr
if not explicitlyEmpty? fr then l := concat("..." :: OUT,l)
- l := reverse_! l
+ l := reverse! l
e := reduce("+",l)
zero? wh => e
(wh :: OUT) + e
diff --git a/src/algebra/cra.spad.pamphlet b/src/algebra/cra.spad.pamphlet
index b5bb6378..8b50ae68 100644
--- a/src/algebra/cra.spad.pamphlet
+++ b/src/algebra/cra.spad.pamphlet
@@ -37,31 +37,31 @@ CRApackage(R:EuclideanDomain): Exports == Implementation where
-- Definition for modular reduction mapping with several moduli
modTree(a,lm) ==
t := balancedBinaryTree(#lm, 0$R)
- setleaves_!(t,lm)
- mapUp_!(t,"*")
- leaves mapDown_!(t, a, "rem")
+ setleaves!(t,lm)
+ mapUp!(t,"*")
+ leaves mapDown!(t, a, "rem")
chineseRemainder(lv:List(R), lm:List(R)):R ==
#lm ~= #lv => error "lists of moduli and values not of same length"
x := balancedBinaryTree(#lm, 0$R)
- x := setleaves_!(x, lm)
- mapUp_!(x,"*")
+ x := setleaves!(x, lm)
+ mapUp!(x,"*")
y := balancedBinaryTree(#lm, 1$R)
- y := mapUp_!(copy y,x,#1 * #4 + #2 * #3)
+ y := mapUp!(copy y,x,#1 * #4 + #2 * #3)
(u := extendedEuclidean(value y, value x,1)) case "failed" =>
error "moduli not relatively prime"
inv := u . coef1
linv := modTree(inv, lm)
l := [(u*v) rem m for v in lv for u in linv for m in lm]
- y := setleaves_!(y,l)
- value(mapUp_!(y, x, #1 * #4 + #2 * #3)) rem value(x)
+ y := setleaves!(y,l)
+ value(mapUp!(y, x, #1 * #4 + #2 * #3)) rem value(x)
chineseRemainder(llv:List List(R), lm:List(R)):List(R) ==
x := balancedBinaryTree(#lm, 0$R)
- x := setleaves_!(x, lm)
- mapUp_!(x,"*")
+ x := setleaves!(x, lm)
+ mapUp!(x,"*")
y := balancedBinaryTree(#lm, 1$R)
- y := mapUp_!(copy y,x,#1 * #4 + #2 * #3)
+ y := mapUp!(copy y,x,#1 * #4 + #2 * #3)
(u := extendedEuclidean(value y, value x,1)) case "failed" =>
error "moduli not relatively prime"
inv := u . coef1
@@ -81,9 +81,9 @@ CRApackage(R:EuclideanDomain): Exports == Implementation where
multiEuclideanTree(fl, rhs) ==
x := balancedBinaryTree(#fl, rhs)
- x := setleaves_!(x, fl)
- mapUp_!(x,"*")
- leaves mapDown_!(x, rhs, extEuclidean)
+ x := setleaves!(x, fl)
+ mapUp!(x,"*")
+ leaves mapDown!(x, rhs, extEuclidean)
@
\section{License}
diff --git a/src/algebra/curve.spad.pamphlet b/src/algebra/curve.spad.pamphlet
index 7b8e73ff..3671bf2b 100644
--- a/src/algebra/curve.spad.pamphlet
+++ b/src/algebra/curve.spad.pamphlet
@@ -213,7 +213,7 @@ FunctionFieldCategory(F, UP, UPUP): Category == Definition where
vars := [concat(string u, string i)::SY for i in 1..n]
x := '%%dummy1
y := '%%dummy2
- select_!(zero?(degree(#1, x)) and zero?(degree(#1, y)),
+ select!(zero?(degree(#1, x)) and zero?(degree(#1, y)),
lexGroebner([v::P - UPUP2P(lift(d * w.i), x::P, y::P)
for v in vars for i in 1..n], concat([x, y], vars)))
@@ -337,12 +337,12 @@ FunctionFieldCategory(F, UP, UPUP): Category == Definition where
for i in minRowIndex m .. maxRowIndex m]$Vector(RF)
for i in minRowIndex m .. maxRowIndex m repeat
for j in minColIndex m .. maxColIndex m repeat
- qsetelt_!(mhat, i, j, qelt(r, i + ii) * qelt(m, i, j))
+ qsetelt!(mhat, i, j, qelt(r, i + ii) * qelt(m, i, j))
sol := first nullSpace transpose map(infValue,
mhat)$MatrixCategoryFunctions2(RF, Vector RF, Vector RF,
Matrix RF, Q, Vector Q, Vector Q, Matrix Q)
(pr := kmin(m, sol)) case "failed" => return ans
- qsetelt_!(ans, pr.pos,
+ qsetelt!(ans, pr.pos,
+/[Q2RF(qelt(sol, i)) * rfmonom(repOrder(m, i - ii) - pr.km)
* qelt(ans, i) for i in minIndex sol .. maxIndex sol])
@@ -669,7 +669,7 @@ RadicalFunctionField(F, UP, UPUP, radicnd, n): Exports == Impl where
v := iBasis(rt.radicand, m)
w:Vector(RF) := new(m, 0)
for i in mini..maxIndex v repeat
- qsetelt_!(w, i, b / ((qelt(v, i)::RF) x))
+ qsetelt!(w, i, b / ((qelt(v, i)::RF) x))
b := b * a
w
@@ -683,8 +683,8 @@ RadicalFunctionField(F, UP, UPUP, radicnd, n): Exports == Impl where
for i in minRowIndex(ib.basis) .. maxRowIndex(ib.basis)
for j in minColIndex(ib.basis) .. maxColIndex(ib.basis)
for k in mini .. maxIndex v repeat
- qsetelt_!(v, k, (qelt(ib.basis, i, j) / ib.basisDen) * a)
- qsetelt_!(w, k, qelt(ib.basisInv, i, j) * inv a)
+ qsetelt!(v, k, (qelt(ib.basis, i, j) / ib.basisDen) * a)
+ qsetelt!(w, k, qelt(ib.basisInv, i, j) * inv a)
a := a * c
void
@@ -714,11 +714,11 @@ RadicalFunctionField(F, UP, UPUP, radicnd, n): Exports == Impl where
infb := inftyBasis(radicnd, n)
invden:RF := 1
for i in mini..maxIndex ib repeat
- qsetelt_!(invibasis, i, a := qelt(ib, i) * invden)
- qsetelt_!(ibasis, i, inv a)
+ qsetelt!(invibasis, i, a := qelt(ib, i) * invden)
+ qsetelt!(ibasis, i, inv a)
invden := invden / rp.coef -- always equals 1/rp.coef**(i-mini)
- qsetelt_!(infbasis, i, a := qelt(infb, i))
- qsetelt_!(invinfbasis, i, inv a)
+ qsetelt!(infbasis, i, a := qelt(infb, i))
+ qsetelt!(invinfbasis, i, inv a)
void
ramified?(p:UP) ==
@@ -853,7 +853,7 @@ AlgebraicFunctionField(F, UP, UPUP, modulus): Exports == Impl where
SimpleAlgebraicExtension(UP, UP2, nmod))
for i in minRowIndex ibasis .. maxRowIndex ibasis repeat
for j in minColIndex ibasis .. maxColIndex ibasis repeat
- qsetelt_!(ibasis, i, j, (ib.basis)(i, j) / ib.basisDen)
+ qsetelt!(ibasis, i, j, (ib.basis)(i, j) / ib.basisDen)
invibasis(i, j) := ((ib.basisInv) (i, j))::RF
if zero?(infbasis(minRowIndex infbasis, minColIndex infbasis))
then getInfBasis()
diff --git a/src/algebra/defaults.spad.pamphlet b/src/algebra/defaults.spad.pamphlet
index b50fee54..9f9bf356 100644
--- a/src/algebra/defaults.spad.pamphlet
+++ b/src/algebra/defaults.spad.pamphlet
@@ -116,8 +116,8 @@ FiniteLinearAggregateSort(S, V): Exports == Implementation where
while (j := 2*i+1) < n repeat
if (k := j+1) < n and l(qelt(r, j), qelt(r, k)) then j := k
if l(t,qelt(r,j)) then
- qsetelt_!(r, i, qelt(r, j))
- qsetelt_!(r, j, t)
+ qsetelt!(r, i, qelt(r, j))
+ qsetelt!(r, j, t)
i := j
else leave
@@ -126,7 +126,7 @@ FiniteLinearAggregateSort(S, V): Exports == Implementation where
n := (#r)::I
for k in shift(n,-1) - 1 .. 0 by -1 repeat siftUp(l, r, k, n)
for k in n-1 .. 1 by -1 repeat
- swap_!(r, 0, k)
+ swap!(r, 0, k)
siftUp(l, r, 0, k)
r
@@ -134,19 +134,19 @@ FiniteLinearAggregateSort(S, V): Exports == Implementation where
-- partition r[i..j] such that r.s <= r.k <= r.t
x := qelt(r, k)
t := qelt(r, i)
- qsetelt_!(r, k, qelt(r, j))
+ qsetelt!(r, k, qelt(r, j))
while i < j repeat
if l(x,t) then
- qsetelt_!(r, j, t)
+ qsetelt!(r, j, t)
j := j-1
- t := qsetelt_!(r, i, qelt(r, j))
+ t := qsetelt!(r, i, qelt(r, j))
else (i := i+1; t := qelt(r, i))
- qsetelt_!(r, j, x)
+ qsetelt!(r, j, x)
j
QuickSort(l, r, i, j) ==
n := j - i
- if one? n and l(qelt(r, j), qelt(r, i)) then swap_!(r, i, j)
+ if one? n and l(qelt(r, j), qelt(r, i)) then swap!(r, i, j)
n < 2 => return r
-- for the moment split at the middle item
k := partition(l, r, i, j, i + shift(n,-1))
@@ -164,7 +164,7 @@ FiniteLinearAggregateSort(S, V): Exports == Implementation where
for i in m+g..n repeat
j := i-g
while j >= m and l(qelt(r, j+g), qelt(r, j)) repeat
- swap_!(r,j,j+g)
+ swap!(r,j,j+g)
j := j-g
g := g quo 3
r
diff --git a/src/algebra/defintef.spad.pamphlet b/src/algebra/defintef.spad.pamphlet
index d4130460..42a7ca0b 100644
--- a/src/algebra/defintef.spad.pamphlet
+++ b/src/algebra/defintef.spad.pamphlet
@@ -217,7 +217,7 @@ ElementaryFunctionDefiniteIntegration(R, F): Exports == Implementation where
ans := empty()$List(OFE)
for g in u::List(F) repeat
(v := computeInt(k, g, a, b, false)) case "failed" => return ["failed"]
- ans := concat_!(ans, [v::OFE])
+ ans := concat!(ans, [v::OFE])
[ans]
@
diff --git a/src/algebra/defintrf.spad.pamphlet b/src/algebra/defintrf.spad.pamphlet
index fc1c6e09..4d85a668 100644
--- a/src/algebra/defintrf.spad.pamphlet
+++ b/src/algebra/defintrf.spad.pamphlet
@@ -176,7 +176,7 @@ DefiniteIntegrationTools(R, F): Exports == Implementation where
i case fin =>
l := realZeros(p, r := i.fin)
incl? => l
- select_!(keeprec?(r.left, #1) and keeprec?(r.right, #1), l)
+ select!(keeprec?(r.left, #1) and keeprec?(r.right, #1), l)
i case all => realZeros p
i case halfinf =>
empty?(l := realZeros p) => empty()
@@ -185,7 +185,7 @@ DefiniteIntegrationTools(R, F): Exports == Implementation where
["min"/[t.left for t in l], i.halfinf.endpoint]
l := [u::REC for t in l | (u := refine(p, t, bounds)) case REC]
incl? => l
- select_!(keeprec?(i.halfinf.endpoint, #1), l)
+ select!(keeprec?(i.halfinf.endpoint, #1), l)
error "findRealZero: should not happpen"
checkBudan(p, a, b, incl?) ==
@@ -329,7 +329,7 @@ RationalFunctionDefiniteIntegration(R): Exports == Implementation where
ans := empty()$List(OFE)
for g in u::List(FE) repeat
(v := computeInt(k, g, a, b, true)) case "failed" => return ["failed"]
- ans := concat_!(ans, [v::OFE])
+ ans := concat!(ans, [v::OFE])
[ans]
integrate(f:RF, s:SegmentBinding ORF) ==
diff --git a/src/algebra/derham.spad.pamphlet b/src/algebra/derham.spad.pamphlet
index 7ddca825..a04576b2 100644
--- a/src/algebra/derham.spad.pamphlet
+++ b/src/algebra/derham.spad.pamphlet
@@ -100,7 +100,7 @@ ExtAlgBasis(): Export == Implement where
-- for j in x repeat
-- if j = 1 then result := cons(cntr,result)
-- cntr:=cntr+1
--- reverse_! result
+-- reverse! result
Nul n == [0 for i in 1..n]
diff --git a/src/algebra/divisor.spad.pamphlet b/src/algebra/divisor.spad.pamphlet
index c256a122..3a177ed4 100644
--- a/src/algebra/divisor.spad.pamphlet
+++ b/src/algebra/divisor.spad.pamphlet
@@ -384,25 +384,25 @@ ModularHermitianRowReduction(R): Exports == Implementation where
rown := k
pivord := npivord
rown = minr - 1 => "enuf"
- x := swapRows_!(x, i, rown)
+ x := swapRows!(x, i, rown)
(a, b, d) := extendedEuclidean(qelt(x,i,j), m)
- qsetelt_!(x,i,j,d)
+ qsetelt!(x,i,j,d)
pivot := d
for k in j+1 .. ncols repeat
- qsetelt_!(x,i,k, a * qelt(x,i,k) rem m)
+ qsetelt!(x,i,k, a * qelt(x,i,k) rem m)
for k in i+1 .. nrows repeat
zero? qelt(x,k,j) => "next k"
q := (qelt(x,k,j) exquo pivot) :: R
for k1 in j+1 .. ncols repeat
v2 := (qelt(x,k,k1) - q * qelt(x,i,k1)) rem m
- qsetelt_!(x, k, k1, v2)
- qsetelt_!(x, k, j, 0)
+ qsetelt!(x, k, k1, v2)
+ qsetelt!(x, k, j, 0)
for k in minr .. i-1 repeat
zero? qelt(x,k,j) => "enuf"
qr := normalizedDivide(qelt(x,k,j), pivot)
- qsetelt_!(x,k,j, qr.remainder)
+ qsetelt!(x,k,j, qr.remainder)
for k1 in j+1 .. ncols x repeat
- qsetelt_!(x,k,k1,
+ qsetelt!(x,k,k1,
(qelt(x,k,k1) - qr.quotient * qelt(x,i,k1)) rem m)
i := i+1
x
@@ -424,7 +424,7 @@ ModularHermitianRowReduction(R): Exports == Implementation where
if (qelt(x,k,j) ~= 0) and ((rown = minr - 1) or
sizeLess?(qelt(x,k,j), qelt(x,rown,j))) then rown := k
rown = minr - 1 => "next j"
- x := swapRows_!(x, i, rown)
+ x := swapRows!(x, i, rown)
for k in i+1 .. nrows repeat
zero? qelt(x,k,j) => "next k"
(a, b, d) := extendedEuclidean(qelt(x,i,j), qelt(x,k,j))
@@ -434,22 +434,22 @@ ModularHermitianRowReduction(R): Exports == Implementation where
for k1 in j+1 .. ncols repeat
v1 := (a * qelt(x,i,k1) + b * qelt(x,k,k1)) rem m
v2 := (b1 * qelt(x,k,k1) - a1 * qelt(x,i,k1)) rem m
- qsetelt_!(x, i, k1, v1)
- qsetelt_!(x, k, k1, v2)
- qsetelt_!(x, i, j, d)
- qsetelt_!(x, k, j, 0)
+ qsetelt!(x, i, k1, v1)
+ qsetelt!(x, k, k1, v2)
+ qsetelt!(x, i, j, d)
+ qsetelt!(x, k, j, 0)
un := unitNormal qelt(x,i,j)
- qsetelt_!(x,i,j,un.canonical)
+ qsetelt!(x,i,j,un.canonical)
if un.associate ~= 1 then for jj in (j+1)..ncols repeat
- qsetelt_!(x,i,jj,un.associate * qelt(x,i,jj))
+ qsetelt!(x,i,jj,un.associate * qelt(x,i,jj))
xij := qelt(x,i,j)
for k in minr .. i-1 repeat
zero? qelt(x,k,j) => "next k"
qr := normalizedDivide(qelt(x,k,j), xij)
- qsetelt_!(x,k,j, qr.remainder)
+ qsetelt!(x,k,j, qr.remainder)
for k1 in j+1 .. ncols x repeat
- qsetelt_!(x,k,k1,
+ qsetelt!(x,k,k1,
(qelt(x,k,k1) - qr.quotient * qelt(x,i,k1)) rem m)
i := i+1
x
@@ -542,7 +542,7 @@ FramedModule(R, F, UP, A, ibasis): Exports == Implementation where
k := minIndex(v := new(#v1 * #v2, 0)$VA)
for i in minIndex v1 .. maxIndex v1 repeat
for j in minIndex v2 .. maxIndex v2 repeat
- qsetelt_!(v, k, qelt(v1, i) * qelt(v2, j))
+ qsetelt!(v, k, qelt(v1, i) * qelt(v2, j))
k := k + 1
v pretend VA
@@ -906,7 +906,7 @@ FiniteDivisor(F, UP, UPUP, R): Exports == Implementation where
"failed"
lSpaceBasis d ==
- map_!(primitivePart, reduceBasisAtInfinity finiteBasis(-d))
+ map!(primitivePart, reduceBasisAtInfinity finiteBasis(-d))
-- b = center, hh = integral function, g = gcd(b, discriminant)
makeDivisor(b, hh, g) ==
diff --git a/src/algebra/efstruc.spad.pamphlet b/src/algebra/efstruc.spad.pamphlet
index 381030eb..7d56b94c 100644
--- a/src/algebra/efstruc.spad.pamphlet
+++ b/src/algebra/efstruc.spad.pamphlet
@@ -40,8 +40,8 @@ SymmetricFunctions(R:Ring): Exports == Implementation where
signFix(p, n) ==
m := minIndex(v := vectorise(p, n)) + 1
for i in 0..((#v quo 2) - 1)::NonNegativeInteger repeat
- qsetelt_!(v, 2*i + m, - qelt(v, 2*i + m))
- reverse_! v
+ qsetelt!(v, 2*i + m, - qelt(v, 2*i + m))
+ reverse! v
@
\section{package TANEXP TangentExpansions}
@@ -230,7 +230,7 @@ ElementaryFunctionStructurePackage(R,F): Exports == Implementation where
tanSum concat(tan c, l)
rootNormalize0 f ==
- ker := select_!(is?(#1, NTHR) and empty? variables first argument #1,
+ ker := select!(is?(#1, NTHR) and empty? variables first argument #1,
tower f)$List(K)
empty? ker => [f, empty(), empty()]
(n := (#ker)::Z - 1) < 1 => [f, empty(), empty()]
diff --git a/src/algebra/expexpan.spad.pamphlet b/src/algebra/expexpan.spad.pamphlet
index 346bf3eb..acfc7f09 100644
--- a/src/algebra/expexpan.spad.pamphlet
+++ b/src/algebra/expexpan.spad.pamphlet
@@ -151,8 +151,8 @@ UnivariatePuiseuxSeriesWithExponentialSingularity(R,FE,var,cen):_
coeff : Term -> UPXS
exponent : Term -> EXPUPXS
exponentTerms : Term -> List PxRec
- setExponentTerms_! : (Term,List PxRec) -> List PxRec
- computeExponentTerms_! : Term -> List PxRec
+ setExponentTerms! : (Term,List PxRec) -> List PxRec
+ computeExponentTerms! : Term -> List PxRec
terms : % -> List Term
sortAndDiscardTerms: List Term -> TRec
termsWithExtremeLeadingCoef : (L Term,RN,I) -> Union(L Term,"failed")
@@ -173,9 +173,9 @@ UnivariatePuiseuxSeriesWithExponentialSingularity(R,FE,var,cen):_
coeff term == term.%coef
exponent term == term.%expon
exponentTerms term == term.%expTerms
- setExponentTerms_!(term,list) == term.%expTerms := list
- computeExponentTerms_! term ==
- setExponentTerms_!(term,entries complete terms exponent term)
+ setExponentTerms!(term,list) == term.%expTerms := list
+ computeExponentTerms! term ==
+ setExponentTerms!(term,entries complete terms exponent term)
terms f ==
-- terms with a higher order singularity will appear closer to the
@@ -249,7 +249,7 @@ UnivariatePuiseuxSeriesWithExponentialSingularity(R,FE,var,cen):_
termList := rest termList
-- reverse "failed terms" so that higher order singularities
-- appear at the beginning of the list
- [zeroTerms,infiniteTerms,reverse_! failedTerms,pSeries]
+ [zeroTerms,infiniteTerms,reverse! failedTerms,pSeries]
termsWithExtremeLeadingCoef(termList,ord,signum) ==
-- 'termList' consists of terms of the form [g(x),exp(f(x)),...];
@@ -289,7 +289,7 @@ UnivariatePuiseuxSeriesWithExponentialSingularity(R,FE,var,cen):_
outList := list term
-- advance pointers on "exponent terms" on terms on 'outList'
for term in outList repeat
- setExponentTerms_!(term,rest exponentTerms term)
+ setExponentTerms!(term,rest exponentTerms term)
[outList,ordExtreme]
dominantTermOnList(termList,ord0,signum) ==
@@ -319,13 +319,13 @@ UnivariatePuiseuxSeriesWithExponentialSingularity(R,FE,var,cen):_
not zero? pSeries => [makeTerm(pSeries,0),"series"]
not empty? infiniteTerms =>
empty? rest infiniteTerms => [first infiniteTerms,"infinity"]
- for term in infiniteTerms repeat computeExponentTerms_! term
+ for term in infiniteTerms repeat computeExponentTerms! term
ord0 := order exponent first infiniteTerms
(dTerm := dominantTermOnList(infiniteTerms,ord0,1)) case "failed" =>
return "failed"
[dTerm :: Term,"infinity"]
empty? rest zeroTerms => [first zeroTerms,"zero"]
- for term in zeroTerms repeat computeExponentTerms_! term
+ for term in zeroTerms repeat computeExponentTerms! term
ord0 := order exponent first zeroTerms
(dTerm := dominantTermOnList(zeroTerms,ord0,-1)) case "failed" =>
return "failed"
diff --git a/src/algebra/expr.spad.pamphlet b/src/algebra/expr.spad.pamphlet
index 85dc5a24..859a46aa 100644
--- a/src/algebra/expr.spad.pamphlet
+++ b/src/algebra/expr.spad.pamphlet
@@ -158,7 +158,7 @@ Expression(R: SetCategory): Exports == Implementation where
-- The result MUST be left sorted deepest first MB 3/90
commonk0(x, y) ==
ans := empty()$List(K)
- for k in reverse_! x repeat if member?(k, y) then ans := concat(k, ans)
+ for k in reverse! x repeat if member?(k, y) then ans := concat(k, ans)
ans
rootOf(x:SparseUnivariatePolynomial %, v:Symbol) == rootOf(x,v)$AF
@@ -319,7 +319,7 @@ Expression(R: SetCategory): Exports == Implementation where
if (a := retractIfCan(x)@Union(AN, "failed")) case "failed" then
return "failed"
else arg := concat(a::AN, arg)
- (operator(op)$AN) reverse_!(arg)
+ (operator(op)$AN) reverse!(arg)
smp2an p ==
(x1 := mainVariable p) case "failed" => R2AN leadingCoefficient p
diff --git a/src/algebra/ffcat.spad.pamphlet b/src/algebra/ffcat.spad.pamphlet
index 9669856f..de353123 100644
--- a/src/algebra/ffcat.spad.pamphlet
+++ b/src/algebra/ffcat.spad.pamphlet
@@ -289,7 +289,7 @@ FiniteAlgebraicExtensionField(F : Field) : Category == _
coordinates(v:Vector $) ==
m := new(#v, extensionDegree(), 0)$Matrix(F)
for i in minIndex v .. maxIndex v for j in minRowIndex m .. repeat
- setRow_!(m, j, coordinates qelt(v, i))
+ setRow!(m, j, coordinates qelt(v, i))
m
algebraic? a == true
transcendent? a == false
@@ -305,7 +305,7 @@ FiniteAlgebraicExtensionField(F : Field) : Category == _
b := basis()
m := new(#b,#b, 0)$Matrix(F)
for i in 1..#b repeat
- setRow_!(m,i, coordinates(a*b.i))
+ setRow!(m,i, coordinates(a*b.i))
determinant(m)
if F has Finite then
linearAssociatedExp(x,f) ==
@@ -463,7 +463,7 @@ DiscreteLogarithmPackage(M): public == private where
a:M:=1
exptable : Table(PI,NNI) :=table()$Table(PI,NNI)
for i in (0::NNI)..(n-1)::NNI repeat
- insert_!([lookup(a),i::NNI]$Record(key:PI,entry:NNI),_
+ insert!([lookup(a),i::NNI]$Record(key:PI,entry:NNI),_
exptable)$Table(PI,NNI)
a:=a*logbase
found := false
diff --git a/src/algebra/fff.spad.pamphlet b/src/algebra/fff.spad.pamphlet
index b73ecc98..d2cc0f7a 100644
--- a/src/algebra/fff.spad.pamphlet
+++ b/src/algebra/fff.spad.pamphlet
@@ -172,7 +172,7 @@ FiniteFieldFunctions(GF): Exports == Implementation where
-- take -v.j to get trace 1 instead of -1
term:TERM:=[(convert(-v.j)@I)::GF,(j-2) pretend SI]$TERM
l:=cons(term,l)$(L TERM)
- qsetelt_!(multtable,i,copy l)$(V L TERM)
+ qsetelt!(multtable,i,copy l)$(V L TERM)
multtable
sizeMultiplication(m) ==
@@ -199,17 +199,17 @@ FiniteFieldFunctions(GF): Exports == Implementation where
qexp:PrimitiveArray(MM):=new(m,0)
qexp.0:=reduce(monomial(1,1)$SUP)$MM
mat:M GF:=zero(m,m)$(M GF)
- qsetelt_!(mat,2,1,1$GF)$(M GF)
+ qsetelt!(mat,2,1,1$GF)$(M GF)
h:=qpow.1
qexp.1:=h
- setColumn_!(mat,2,Vectorise(h)$MM)$(M GF)
+ setColumn!(mat,2,Vectorise(h)$MM)$(M GF)
for i in 2..m1 repeat
g:=0$MM
while h ~= 0 repeat
g:=g + leadingCoefficient(h) * qpow.degree(h)$MM
h:=reductum(h)$MM
qexp.i:=g
- setColumn_!(mat,i+1,Vectorise(h:=g)$MM)$(M GF)
+ setColumn!(mat,i+1,Vectorise(h:=g)$MM)$(M GF)
-- loop invariant: qexp.i = x**(q**i)
mat1:=inverse(mat)$(M GF)
mat1 = "failed" =>
@@ -224,7 +224,7 @@ FiniteFieldFunctions(GF): Exports == Implementation where
if (v.j ~= 0$GF) then
term:TERM:=[(v.j),j-(2::SI)]$TERM
l:=cons(term,l)$(L TERM)
- qsetelt_!(multtable,i,copy l)$(V L TERM)
+ qsetelt!(multtable,i,copy l)$(V L TERM)
multtable
@@ -257,7 +257,7 @@ FiniteFieldFunctions(GF): Exports == Implementation where
mat:M GF:=zero(n,n)$(M GF)
for i in 1..n repeat
for t in m.i repeat
- qsetelt_!(mat,i,t.index+2,t.value)
+ qsetelt!(mat,i,t.index+2,t.value)
mat
@
diff --git a/src/algebra/ffhom.spad.pamphlet b/src/algebra/ffhom.spad.pamphlet
index 6195d5b6..30e8302b 100644
--- a/src/algebra/ffhom.spad.pamphlet
+++ b/src/algebra/ffhom.spad.pamphlet
@@ -164,14 +164,14 @@ FiniteFieldHomomorphisms(F1,GF,F2): Exports == Implementation where
mat:=zero(degree1,degree1)$M
arr:=reducedQPowers(defPol1)$FFPOLY(GF)
for i in 1..degree1 repeat
- setColumn_!(mat,i,vectorise(arr.(i-1),degree1)$SUP(GF))$M
+ setColumn!(mat,i,vectorise(arr.(i-1),degree1)$SUP(GF))$M
-- old code
-- here one of the representation types must be "normal"
--a:=basis()$FFP(GF,defPol1).2 -- the root of the def. polynomial
- --setColumn_!(mat,1,coordinates(a)$FFP(GF,defPol1))$M
+ --setColumn!(mat,1,coordinates(a)$FFP(GF,defPol1))$M
--for i in 2..degree1 repeat
-- a:= a **$FFP(GF,defPol1) size()$GF
- -- setColumn_!(mat,i,coordinates(a)$FFP(GF,defPol1))$M
+ -- setColumn!(mat,i,coordinates(a)$FFP(GF,defPol1))$M
--for the direction "normal" -> "polynomial" we have to multiply the
-- coordinate vector of an element of the normal basis field with
-- the matrix 'mat'. In this case 'mat' is the correct conversion
@@ -220,10 +220,10 @@ FiniteFieldHomomorphisms(F1,GF,F2): Exports == Implementation where
root:=rootOfIrreduciblePoly(dPsmall)$FFPOL2(FFP(GF,dPbig),GF)
-- set up matrix for polynomial conversion
matsb:=zero(degbig,degsmall)$M
- qsetelt_!(matsb,1,1,1$GF)$M
+ qsetelt!(matsb,1,1,1$GF)$M
a:=root
for i in 2..degsmall repeat
- setColumn_!(matsb,i,coordinates(a)$FFP(GF,dPbig))$M
+ setColumn!(matsb,i,coordinates(a)$FFP(GF,dPbig))$M
a := a *$FFP(GF,dPbig) root
-- the conversion from 'big' to 'small': we can't invert matsb
-- directly, because it has degbig rows and degsmall columns and
@@ -245,7 +245,7 @@ FiniteFieldHomomorphisms(F1,GF,F2): Exports == Implementation where
mat:=inverse(mat)$M :: M
matbs:=zero(degsmall,degbig)$M
for i in 1..degsmall repeat
- setColumn_!(matbs,iVec.i,column(mat,i)$M)$M
+ setColumn!(matbs,iVec.i,column(mat,i)$M)$M
-- print(matsb::OUT)
-- print(matbs::OUT)
-- 4) if the 'bigger' field is "normal" we have to compose the
@@ -261,13 +261,13 @@ FiniteFieldHomomorphisms(F1,GF,F2): Exports == Implementation where
arr:=reducedQPowers(dPbig)$FFPOLY(GF)
mat:=zero(degbig,degbig)$M
for i in 1..degbig repeat
- setColumn_!(mat,i,vectorise(arr.(i-1),degbig)$SUP(GF))$M
+ setColumn!(mat,i,vectorise(arr.(i-1),degbig)$SUP(GF))$M
-- old code
--a:=basis()$FFP(GF,dPbig).2 -- the root of the def.Polynomial
- --setColumn_!(mat,1,coordinates(a)$FFP(GF,dPbig))$M
+ --setColumn!(mat,1,coordinates(a)$FFP(GF,dPbig))$M
--for i in 2..degbig repeat
-- a:= a **$FFP(GF,dPbig) size()$GF
- -- setColumn_!(mat,i,coordinates(a)$FFP(GF,dPbig))$M
+ -- setColumn!(mat,i,coordinates(a)$FFP(GF,dPbig))$M
-- print(inverse(mat)$M::OUT)
matsb:= (inverse(mat)$M :: M) * matsb
-- print("inv *.."::OUT)
@@ -284,13 +284,13 @@ FiniteFieldHomomorphisms(F1,GF,F2): Exports == Implementation where
arr:=reducedQPowers(dPsmall)$FFPOLY(GF)
mat:=zero(degsmall,degsmall)$M
for i in 1..degsmall repeat
- setColumn_!(mat,i,vectorise(arr.(i-1),degsmall)$SUP(GF))$M
+ setColumn!(mat,i,vectorise(arr.(i-1),degsmall)$SUP(GF))$M
-- old code
--b:FFP(GF,dPsmall):=basis()$FFP(GF,dPsmall).2
- --setColumn_!(mat,1,coordinates(b)$FFP(GF,dPsmall))$M
+ --setColumn!(mat,1,coordinates(b)$FFP(GF,dPsmall))$M
--for i in 2..degsmall repeat
-- b:= b **$FFP(GF,dPsmall) size()$GF
- -- setColumn_!(mat,i,coordinates(b)$FFP(GF,dPsmall))$M
+ -- setColumn!(mat,i,coordinates(b)$FFP(GF,dPsmall))$M
-- print(mat::OUT)
matsb:= matsb * mat
matbs:= (inverse(mat) :: M) * matbs
diff --git a/src/algebra/ffnb.spad.pamphlet b/src/algebra/ffnb.spad.pamphlet
index d37fe749..758e4d9a 100644
--- a/src/algebra/ffnb.spad.pamphlet
+++ b/src/algebra/ffnb.spad.pamphlet
@@ -346,7 +346,7 @@ InnerNormalBasisFieldFunctions(GF): Exports == Implementation where
dy:=#y
for j in 1..dy repeat
for k in 0..((dx quo dy)-1) repeat
- qsetelt_!(m,j+k*dy,i,y.j)$(M GF)
+ qsetelt!(m,j+k*dy,i,y.j)$(M GF)
y:=y *$$ x
v:=first nullSpace(m)$(M GF)
pol(v)$$
@@ -355,13 +355,13 @@ InnerNormalBasisFieldFunctions(GF): Exports == Implementation where
bas:(V VGF):=new(n,zero(n)$VGF)$(V VGF)
for i in 1..n repeat
uniti:=zero(n)$VGF
- qsetelt_!(uniti,i,1$GF)$VGF
- qsetelt_!(bas,i,uniti)$(V VGF)
+ qsetelt!(uniti,i,1$GF)$VGF
+ qsetelt!(bas,i,uniti)$(V VGF)
bas
normalElement(n) ==
v:=zero(n)$VGF
- qsetelt_!(v,1,1$GF)
+ qsetelt!(v,1,1$GF)
v
-- normalElement(n) == index(n,1)$$
@@ -627,9 +627,9 @@ FiniteFieldNormalBasisExtensionByPolynomial(GF,uni): Exports == _
tbl:TBL:=table()$TBL
a:$:=1
for i in (0::NNI)..(n-1)::NNI repeat
- insert_!([lookup(a),i::NNI]$R,tbl)$TBL
+ insert!([lookup(a),i::NNI]$R,tbl)$TBL
a:=a*base
- insert_!([fac::PI,copy(tbl)$TBL]_
+ insert!([fac::PI,copy(tbl)$TBL]_
$Record(key:PI,entry:TBL),discLogTable)$Table(PI,TBL)
initlog?:=false
-- tell user about initialization
diff --git a/src/algebra/ffp.spad.pamphlet b/src/algebra/ffp.spad.pamphlet
index 02ed358e..8455ad76 100644
--- a/src/algebra/ffp.spad.pamphlet
+++ b/src/algebra/ffp.spad.pamphlet
@@ -136,7 +136,7 @@ FiniteFieldExtensionByPolynomial(GF:FiniteFieldCategory,_
y:$:=1
m:=zero(extdeg,extdeg+1)$(Matrix GF)
for i in 1..extdeg+1 repeat
- setColumn_!(m,i,coordinates(y))$(Matrix GF)
+ setColumn!(m,i,coordinates(y))$(Matrix GF)
y:=y*x
rank(m)::PI
@@ -144,7 +144,7 @@ FiniteFieldExtensionByPolynomial(GF:FiniteFieldCategory,_
y:$:=1
m:=zero(extdeg,extdeg+1)$(Matrix GF)
for i in 1..extdeg+1 repeat
- setColumn_!(m,i,coordinates(y))$(Matrix GF)
+ setColumn!(m,i,coordinates(y))$(Matrix GF)
y:=y*x
v:=first nullSpace(m)$(Matrix GF)
+/[monomial(v.(i+1),i)$(SUP GF) for i in 0..extdeg]
@@ -239,9 +239,9 @@ FiniteFieldExtensionByPolynomial(GF:FiniteFieldCategory,_
tbl:TBL:=table()$TBL
a:$:=1
for i in (0::NNI)..(n-1)::NNI repeat
- insert_!([lookup(a),i::NNI]$R,tbl)$TBL
+ insert!([lookup(a),i::NNI]$R,tbl)$TBL
a:=a*base
- insert_!([fac::PI,copy(tbl)$TBL]_
+ insert!([fac::PI,copy(tbl)$TBL]_
$Record(key:PI,entry:TBL),discLogTable)$Table(PI,TBL)
-- set logarithm initialization flag
initlog? := false
diff --git a/src/algebra/ffpoly.spad.pamphlet b/src/algebra/ffpoly.spad.pamphlet
index b6f2f767..5fd9cd38 100644
--- a/src/algebra/ffpoly.spad.pamphlet
+++ b/src/algebra/ffpoly.spad.pamphlet
@@ -411,13 +411,13 @@ FiniteFieldPolynomialPackage GF : Exports == Implementation where
secondOfs = firstOfsPlus1 =>
s := restOfs
i := i + 1
- setfirst_!(s, firstOfsPlus1) -- s := [s(i)+1, s(i+1),..., s(m)]
+ setfirst!(s, firstOfsPlus1) -- s := [s(i)+1, s(i+1),..., s(m)]
noGap := false
if noGap then -- here s = [s(m)]
firstOfs := first s
- firstOfs < bound => setfirst_!(s, firstOfs + 1) -- s := [s(m)+1]
+ firstOfs < bound => setfirst!(s, firstOfs + 1) -- s := [s(m)+1]
m < bound =>
- setfirst_!(s, m + 1) -- s := [m+1]
+ setfirst!(s, m + 1) -- s := [m+1]
i := m
return "failed" -- (here m = s(m) = bound)
for j in i..1 by -1 repeat -- reconstruct the destroyed
@@ -471,7 +471,7 @@ FiniteFieldPolynomialPackage GF : Exports == Implementation where
headlookuplist := rest headlookuplist
-- otherwise set f{i1} := index(j)$GF
setelt(first headpol, coeff, index(j :: PI)$GF)
- setfirst_!(headlookuplist, j)
+ setfirst!(headlookuplist, j)
if empty? taillookuplist then
pol := revListToSUP(headpol)
--
@@ -586,7 +586,7 @@ FiniteFieldPolynomialPackage GF : Exports == Implementation where
headlookuplist := rest headlookuplist
-- otherwise set f{i1} := index(j)$GF
setelt(first headpol, coeff, index(j :: PI)$GF)
- setfirst_!(headlookuplist, j)
+ setfirst!(headlookuplist, j)
if empty? taillookuplist then
pol := revListToSUP cons(constterm, headpol)
--
@@ -697,7 +697,7 @@ FiniteFieldPolynomialPackage GF : Exports == Implementation where
middlelookuplist := rest middlelookuplist
-- otherwise set f{i1} := index(j)$GF
setelt(first middlepol, coeff, index(j :: PI)$GF)
- setfirst_!(middlelookuplist, j)
+ setfirst!(middlelookuplist, j)
if empty? taillookuplist then
pol := listToSUP append(headpol, reverse middlepol)
--
@@ -834,7 +834,7 @@ FiniteFieldPolynomialPackage GF : Exports == Implementation where
middlelookuplist := rest middlelookuplist
-- otherwise set f{i1} := index(j)$GF
setelt(first middlepol, coeff, index(j :: PI)$GF)
- setfirst_!(middlelookuplist, j)
+ setfirst!(middlelookuplist, j)
if empty? taillookuplist then
pol := listToSUP append(headpol, reverse
cons(constterm, middlepol))
diff --git a/src/algebra/files.spad.pamphlet b/src/algebra/files.spad.pamphlet
index 43336496..18eb2a77 100644
--- a/src/algebra/files.spad.pamphlet
+++ b/src/algebra/files.spad.pamphlet
@@ -77,12 +77,12 @@ FileCategory(Name, S): Category == FCdefinition where
++ open(s,mode) returns a file s open for operation in the
++ indicated mode: "input" or "output".
- reopen_!: (%, IOMode) -> %
+ reopen!: (%, IOMode) -> %
++ reopen!(f,mode) returns a file f reopened for operation in the
++ indicated mode: "input" or "output".
++ \spad{reopen!(f,"input")} will reopen the file f for input.
- close_!: % -> %
+ close!: % -> %
++ close!(f) returns the file f closed to input and output.
name: % -> Name
@@ -92,12 +92,12 @@ FileCategory(Name, S): Category == FCdefinition where
++ iomode(f) returns the status of the file f. The input/output
++ status of f may be "input", "output" or "closed" mode.
- read_!: % -> S
+ read!: % -> S
++ read!(f) extracts a value from file f. The state of f is
++ modified so a subsequent call to \spadfun{read!} will return
++ the next element.
- write_!: (%,S) -> S
+ write!: (%,S) -> S
++ write!(f,s) puts the value s into the file f.
++ The state of f is modified so subsequents call to \spad{write!}
++ will append one after another.
@@ -121,7 +121,7 @@ FileCategory(Name, S): Category == FCdefinition where
++ The operations provide sequential access to the contents.
File(S:SetCategory): FileCategory(FileName, S) with
- readIfCan_!: % -> Union(S, "failed")
+ readIfCan!: % -> Union(S, "failed")
++ readIfCan!(f) returns a value from the file f, if possible.
++ If f is not open for reading, or if f is at the end of file
++ then \spad{"failed"} is the result.
@@ -152,12 +152,12 @@ File(S:SetCategory): FileCategory(FileName, S) with
open(fname, mode) ==
fstream := defstream(fname, mode)
[fname, fstream, mode]
- reopen_!(f, mode) ==
+ reopen!(f, mode) ==
fname := f.fileName
f.fileState := defstream(fname, mode)
f.fileIOmode:= mode
f
- close_! f ==
+ close! f ==
SHUT(f.fileState)$Lisp
f.fileIOmode := "closed"
f
@@ -165,20 +165,20 @@ File(S:SetCategory): FileCategory(FileName, S) with
f.fileName
iomode f ==
f.fileIOmode
- read_! f ==
+ read! f ==
f.fileIOmode ~= "input" =>
error "File not in read state"
x := VMREAD(f.fileState)$Lisp
PLACEP(x)$Lisp =>
error "End of file"
x
- readIfCan_! f ==
+ readIfCan! f ==
f.fileIOmode ~= "input" =>
error "File not in read state"
x: S := VMREAD(f.fileState)$Lisp
PLACEP(x)$Lisp => "failed"
x
- write_!(f, x) ==
+ write!(f, x) ==
f.fileIOmode ~= "output" =>
error "File not in write state"
z := PRINT_-FULL(x, f.fileState)$Lisp
@@ -206,26 +206,26 @@ TextFile: Cat == Def where
StreamName ==> Union(FileName, "console")
Cat == FileCategory(FileName, String) with
- writeLine_!: (%, String) -> String
+ writeLine!: (%, String) -> String
++ writeLine!(f,s) writes the contents of the string s
++ and finishes the current line in the file f.
++ The value of s is returned.
- writeLine_!: % -> String
+ writeLine!: % -> String
++ writeLine!(f) finishes the current line in the file f.
++ An empty string is returned. The call \spad{writeLine!(f)} is
++ equivalent to \spad{writeLine!(f,"")}.
- readLine_!: % -> String
+ readLine!: % -> String
++ readLine!(f) returns a string of the contents of a line from
++ the file f.
- readLineIfCan_!: % -> Union(String, "failed")
+ readLineIfCan!: % -> Union(String, "failed")
++ readLineIfCan!(f) returns a string of the contents of a line from
++ file f, if possible. If f is not readable or if it is
++ positioned at the end of file, then \spad{"failed"} is returned.
- readIfCan_!: % -> Union(String, "failed")
+ readIfCan!: % -> Union(String, "failed")
++ readIfCan!(f) returns a string of the contents of a line from
++ file f, if possible. If f is not readable or if it is
++ positioned at the end of file, then \spad{"failed"} is returned.
@@ -242,28 +242,28 @@ TextFile: Cat == Def where
fileState: FileState, _
fileIOmode: String)
- read_! f == readLine_! f
- readIfCan_! f == readLineIfCan_! f
+ read! f == readLine! f
+ readIfCan! f == readLineIfCan! f
- readLine_! f ==
+ readLine! f ==
f.fileIOmode ~= "input" => error "File not in read state"
s: String := read_-line(f.fileState)$Lisp
PLACEP(s)$Lisp => error "End of file"
s
- readLineIfCan_! f ==
+ readLineIfCan! f ==
f.fileIOmode ~= "input" => error "File not in read state"
s: String := read_-line(f.fileState)$Lisp
PLACEP(s)$Lisp => "failed"
s
- write_!(f, x) ==
+ write!(f, x) ==
f.fileIOmode ~= "output" => error "File not in write state"
PRINTEXP(x, f.fileState)$Lisp
x
- writeLine_! f ==
+ writeLine! f ==
f.fileIOmode ~= "output" => error "File not in write state"
TERPRI(f.fileState)$Lisp
""
- writeLine_!(f, x) ==
+ writeLine!(f, x) ==
f.fileIOmode ~= "output" => error "File not in write state"
PRINTEXP(x, f.fileState)$Lisp
TERPRI(f.fileState)$Lisp
@@ -302,7 +302,7 @@ KeyedAccessFile(Entry): KAFcategory == KAFcapsule where
Join(FileCategory(Name, Record(key: Key, entry: Entry)),
TableAggregate(Key, Entry)) with
finiteAggregate
- pack_!: % -> %
+ pack!: % -> %
++ pack!(f) reorganizes the file f on disk to recover
++ unused space.
@@ -341,28 +341,28 @@ KeyedAccessFile(Entry): KAFcategory == KAFcapsule where
exists? fname =>
open(fname, "input")
writable? fname =>
- reopen_!(open(fname, "output"), "input")
+ reopen!(open(fname, "output"), "input")
error "File does not exist and cannot be created"
[fname, defstream(fname, mode), mode]
- reopen_!(f, mode) ==
- close_! f
+ reopen!(f, mode) ==
+ close! f
if mode ~= "closed" then
f.fileState := defstream(f.fileName, mode)
f.fileIOmode := mode
f
- close_! f ==
+ close! f ==
if f.fileIOmode ~= "closed" then
RSHUT(f.fileState)$Lisp
f.fileIOmode := "closed"
f
- read_! f ==
+ read! f ==
f.fileIOmode ~= "input" => error ["File not in read state",f]
ks: List Symbol := RKEYIDS(f.fileName)$Lisp
null ks => error ["Attempt to read empty file", f]
ix := random()$Integer rem #ks
k: String := PNAME(ks.ix)$Lisp
[k, SPADRREAD(k, f.fileState)$Lisp]
- write_!(f, pr) ==
+ write!(f, pr) ==
f.fileIOmode ~= "output" => error ["File not in write state",f]
SPADRWRITE(pr.key, pr.entry, f.fileState)$Lisp
pr
@@ -376,32 +376,32 @@ KeyedAccessFile(Entry): KAFcategory == KAFcapsule where
fn := new("", "kaf", "sdata")$Name
open fn
keys f ==
- close_! f
+ close! f
l: List SExpression := RKEYIDS(f.fileName)$Lisp
[PNAME(n)$Lisp for n in l]
# f ==
# keys f
elt(f,k) ==
- reopen_!(f, "input")
+ reopen!(f, "input")
SPADRREAD(k, f.fileState)$Lisp
setelt(f,k,e) ==
-- Leaves f in a safe, closed state. For speed use "write".
- reopen_!(f, "output")
- UNWIND_-PROTECT(write_!(f, [k,e]), close_! f)$Lisp
- close_! f
+ reopen!(f, "output")
+ UNWIND_-PROTECT(write!(f, [k,e]), close! f)$Lisp
+ close! f
e
search(k,f) ==
not member?(k, keys f) => "failed" -- can't trap RREAD error
- reopen_!(f, "input")
+ reopen!(f, "input")
(SPADRREAD(k, f.fileState)$Lisp)@Entry
- remove_!(k:String,f:%) ==
+ remove!(k:String,f:%) ==
result := search(k,f)
result case "failed" => result
- close_! f
+ close! f
RDROPITEMS(NAMESTRING(f.fileName)$Lisp, LIST(k)$Lisp)$Lisp
result
- pack_! f ==
- close_! f
+ pack! f ==
+ close! f
RPACKFILE(f.fileName)$Lisp
f
@@ -424,7 +424,7 @@ KeyedAccessFile(Entry): KAFcategory == KAFcapsule where
Library(): TableAggregate(String, Any) with
library: FileName -> %
++ library(ln) creates a new library file.
- pack_!: % -> %
+ pack!: % -> %
++ pack!(f) reorganizes the file f on disk to recover
++ unused space.
diff --git a/src/algebra/fr.spad.pamphlet b/src/algebra/fr.spad.pamphlet
index ebab36e4..578054d4 100644
--- a/src/algebra/fr.spad.pamphlet
+++ b/src/algebra/fr.spad.pamphlet
@@ -284,7 +284,7 @@ Factored(R: IntegralDomain): Exports == Implementation where
SimplifyFactorization x ==
empty? x => empty()
- x := sort_!(LispLessP, x)
+ x := sort!(LispLessP, x)
x := SimplifyFactorization1(first x, rest x)
x := sort!(LispLessP, x)
x
@@ -466,7 +466,7 @@ which causes wrong results as soon as units are involved, for example in
as := as * (ucar.associate ** e)
if not one?(ucar.canonical) then
vl := concat([x.flg, ucar.canonical, x.xpnt], vl)
- [mkFF(un, empty()), mkFF(1, reverse_! vl), mkFF(as, empty())]
+ [mkFF(un, empty()), mkFF(1, reverse! vl), mkFF(as, empty())]
unitNormalize u ==
uca := unitNormal u
diff --git a/src/algebra/free.spad.pamphlet b/src/algebra/free.spad.pamphlet
index 25f04f87..90588505 100644
--- a/src/algebra/free.spad.pamphlet
+++ b/src/algebra/free.spad.pamphlet
@@ -55,7 +55,7 @@ ListMonoidOps(S, E, un): Exports == Implementation where
++ reverse(l) reverses the list of monomials forming l. This
++ has some effect if the monoid is non-abelian, i.e.
++ \spad{reverse(a1\^e1 ... an\^en) = an\^en ... a1\^e1} which is different.
- reverse_! : $ -> $
+ reverse! : $ -> $
++ reverse!(l) reverses the list of monomials forming l, destroying
++ the element l.
size : $ -> NonNegativeInteger
@@ -102,14 +102,14 @@ ListMonoidOps(S, E, un): Exports == Implementation where
nthExpon(f, i) == f.(i-1+minIndex f).exp
nthFactor(f, i) == f.(i-1+minIndex f).gen
reverse l == reverse(l)$Rep
- reverse_! l == reverse_!(l)$Rep
+ reverse! l == reverse!(l)$Rep
mapGen(f, l) == [[f(x.gen), x.exp] for x in l]
mapExpon(f, l) ==
ans:List(REC) := empty()
for x in l repeat
if (a := f(x.exp)) ~= 0 then ans := concat([x.gen, a], ans)
- reverse_! ans
+ reverse! ans
outputForm(l, op, opexp, id) ==
empty? l => id::OutputForm
@@ -123,7 +123,7 @@ ListMonoidOps(S, E, un): Exports == Implementation where
rightMult(f, s) ==
empty? f => s::$
- s = f.last.gen => (setlast_!(h := copy f, [s, f.last.exp + un]); h)
+ s = f.last.gen => (setlast!(h := copy f, [s, f.last.exp + un]); h)
concat(f, [s, un])
leftMult(s, f) ==
@@ -137,7 +137,7 @@ ListMonoidOps(S, E, un): Exports == Implementation where
if not member?(t1,s2) then return false
true
- plus_!(s:S, n:E, f:$):$ ==
+ plus!(s:S, n:E, f:$):$ ==
h := g := concat([s, n], f)
h1 := rest h
while not empty? h1 repeat
@@ -145,13 +145,13 @@ ListMonoidOps(S, E, un): Exports == Implementation where
l :=
zero?(m := n + h1.first.exp) => rest h1
concat([s, m], rest h1)
- setrest_!(h, l)
+ setrest!(h, l)
return rest g
h := h1
h1 := rest h1
g
- plus(s, n, f) == plus_!(s,n,copy f)
+ plus(s, n, f) == plus!(s,n,copy f)
plus(f, g) ==
#f < #g => localplus(f, g)
@@ -229,7 +229,7 @@ FreeMonoid(S: SetCategory): FMcategory == FMdefinition where
1 == makeUnit()
one? f == empty? listOfMonoms f
coerce(f:$): Ex == outputForm(f, "*", "**", 1)
- hcrf(f, g) == reverse_! hclf(reverse f, reverse g)
+ hcrf(f, g) == reverse! hclf(reverse f, reverse g)
f:$ * s:S == rightMult(f, s)
s:S * f:$ == leftMult(s, f)
factors f == copy listOfMonoms f
@@ -243,7 +243,7 @@ FreeMonoid(S: SetCategory): FMcategory == FMdefinition where
lg := listOfMonoms g
ls := last(lf := listOfMonoms f)
ls.gen = lg.first.gen =>
- setlast_!(h := copy lf,[lg.first.gen,lg.first.exp+ls.exp])
+ setlast!(h := copy lf,[lg.first.gen,lg.first.exp+ls.exp])
makeMulti concat(h, rest lg)
makeMulti concat(lf, lg)
@@ -264,13 +264,13 @@ FreeMonoid(S: SetCategory): FMcategory == FMdefinition where
if (ru:= lquo(makeMulti rest lar,
makeMulti rest lla)) case $ then
if lla.first.exp > lar.first.exp then
- l := concat_!(l, [lla.first.gen,
+ l := concat!(l, [lla.first.gen,
(lla.first.exp - lar.first.exp)::NNI])
m := concat([lla.first.gen, lar.first.exp],
rest lla)
else m := lla
return [makeMulti l, makeMulti m, ru::$]
- l := concat_!(l, lla.first)
+ l := concat!(l, lla.first)
lla := rest lla
[makeMulti la0, 1, makeMulti lar]
@@ -286,10 +286,10 @@ FreeMonoid(S: SetCategory): FMcategory == FMdefinition where
-- Now match tail.
(q:=lquo(makeMulti rest llar,makeMulti rest la))case $ =>
if llar.first.exp > la.first.exp then
- l := concat_!(l, [la.first.gen,
+ l := concat!(l, [la.first.gen,
(llar.first.exp - la.first.exp)::NNI])
return [makeMulti l, q::$]
- l := concat_!(l, first llar)
+ l := concat!(l, first llar)
llar := rest llar
Nlar := Nlar - 1
"failed"
@@ -298,7 +298,7 @@ FreeMonoid(S: SetCategory): FMcategory == FMdefinition where
h:List(REC) := empty()
for f0 in listOfMonoms f for g0 in listOfMonoms g repeat
f0.gen ~= g0.gen => return makeMulti h
- h := concat_!(h, [f0.gen, min(f0.exp, g0.exp)])
+ h := concat!(h, [f0.gen, min(f0.exp, g0.exp)])
f0.exp ~= g0.exp => return makeMulti h
makeMulti h
@@ -308,13 +308,13 @@ FreeMonoid(S: SetCategory): FMcategory == FMdefinition where
a0.gen ~= laq.first.gen or a0.exp > laq.first.exp =>
return "failed"
if a0.exp = laq.first.exp then laq := rest laq
- else setfirst_!(laq, [laq.first.gen,
+ else setfirst!(laq, [laq.first.gen,
(laq.first.exp - a0.exp)::NNI])
makeMulti laq
rquo(qa, a) ==
(u := lquo(reverse qa, reverse a)) case "failed" => "failed"
- reverse_!(u::$)
+ reverse!(u::$)
if S has OrderedSet then
a < b ==
@@ -381,7 +381,7 @@ FreeGroup(S: SetCategory): Join(Group, RetractableTo S) with
s:S ** n:Integer == makeTerm(s, n)
f:$ * s:S == rightMult(f, s)
s:S * f:$ == leftMult(s, f)
- inv f == reverse_! mapExpon("-", f)
+ inv f == reverse! mapExpon("-", f)
factors f == copy listOfMonoms f
mapExpon(f, x) == mapExpon(f, x)$Rep
mapGen(f, x) == mapGen(f, x)$Rep
@@ -397,12 +397,12 @@ FreeGroup(S: SetCategory): Join(Group, RetractableTo S) with
r := rest r
q := rest q
empty? r => makeMulti q
- empty? q => makeMulti reverse_! r
+ empty? q => makeMulti reverse! r
r.first.gen = q.first.gen =>
- setlast_!(h := reverse_! r,
+ setlast!(h := reverse! r,
[q.first.gen, q.first.exp + r.first.exp])
- makeMulti concat_!(h, rest q)
- makeMulti concat_!(reverse_! r, q)
+ makeMulti concat!(h, rest q)
+ makeMulti concat!(reverse! r, q)
@
\section{category FAMONC FreeAbelianMonoidCategory}
diff --git a/src/algebra/fspace.spad.pamphlet b/src/algebra/fspace.spad.pamphlet
index 7d2a4eee..281ee846 100644
--- a/src/algebra/fspace.spad.pamphlet
+++ b/src/algebra/fspace.spad.pamphlet
@@ -279,7 +279,7 @@ ExpressionSpace(): Category == Defn where
is?(k::K, op)
unwrap(l, x) ==
- for k in reverse_! l repeat
+ for k in reverse! l repeat
x := eval(x, k, first argument k)
x
@@ -599,7 +599,7 @@ FunctionSpace(R: SetCategory): Category == Definition where
l := empty()$List(SY)
for k in tower x repeat
if ((s := symbolIfCan k) case SY) then l := concat(s::SY, l)
- reverse_! l
+ reverse! l
retractIfCan(x:%):Union(SY, "failed") ==
(k := retractIfCan(x)@Union(K,"failed")) case "failed" => "failed"
diff --git a/src/algebra/intaf.spad.pamphlet b/src/algebra/intaf.spad.pamphlet
index 284e11ea..26ba8ad4 100644
--- a/src/algebra/intaf.spad.pamphlet
+++ b/src/algebra/intaf.spad.pamphlet
@@ -525,7 +525,7 @@ PureAlgebraicIntegration(R, F, L): Exports == Implementation where
then l := concat(n * chv(v::UPUP,rec.exponent, 1, 0), l) else FAIL
m := monomial(1, rec.exponent)$UPUP - q::RF::UPUP
map(UPUP2F0(RF2UPUP(#1,m), x, k),
- limitedint(n * chv(uf::UPUP, rec.exponent, 1, 0), reverse_! l))
+ limitedint(n * chv(uf::UPUP, rec.exponent, 1, 0), reverse! l))
cv := chvar(ff, modulus)
r := radPoly(cv.poly)::Record(radicand:RF, deg:N)
dqdx := inv(differentiate(q := retract(r.radicand)@UP)::RF)
@@ -563,7 +563,7 @@ PureAlgebraicIntegration(R, F, L): Exports == Implementation where
neq:LDALG := 0
for f in eq for i in 0.. repeat
neq := neq + monomial(reduce univariate(f, kx, y, p), i)
- empty? remove_!(y, remove_!(kx, varselect(kernels g, x))) =>
+ empty? remove!(y, remove!(kx, varselect(kernels g, x))) =>
rec := algDsolve(neq, reduce univariate(g, kx, y, p))$RDALG
bas:List(F) := [UPUP2F0(lift h, kx, y) for h in rec.basis]
rec.particular case "failed" => ["failed", bas]
diff --git a/src/algebra/intalg.spad.pamphlet b/src/algebra/intalg.spad.pamphlet
index 4bf34804..22c18476 100644
--- a/src/algebra/intalg.spad.pamphlet
+++ b/src/algebra/intalg.spad.pamphlet
@@ -121,7 +121,7 @@ AlgebraicHermiteIntegration(F,UP,UPUP,R):Exports == Implementation where
for k in minColIndex mat .. maxColIndex mat repeat
(bc := extendedEuclidean(qelt(mat, j, k), modulus,
qelt(vec, i))) case "failed" => return new(0, 0)
- qsetelt_!(ans, i, bc.coef1)
+ qsetelt!(ans, i, bc.coef1)
ans
sol := particularSolution(map(#1::RF, mat)$MatrixCategoryFunctions2(UP,
Vector UP, Vector UP, Matrix UP, RF,
@@ -133,7 +133,7 @@ AlgebraicHermiteIntegration(F,UP,UPUP,R):Exports == Implementation where
for i in minIndex ans .. maxIndex ans repeat
(bc := extendedEuclidean(denom qelt(sol, i), modulus, 1))
case "failed" => return new(0, 0)
- qsetelt_!(ans, i, (numer qelt(sol, i) * bc.coef1) rem modulus)
+ qsetelt!(ans, i, (numer qelt(sol, i) * bc.coef1) rem modulus)
ans
@
@@ -232,8 +232,8 @@ AlgebraicIntegrate(R0, F, UP, UPUP, R): Exports == Implementation where
vf:Vector(QF) := new(n, 0)
for i in minIndex v .. maxIndex v repeat
r := separate(qelt(v, i) / d)$GP
- qsetelt_!(vf, i, r.fracPart)
- qsetelt_!(vp, i, r.polyPart)
+ qsetelt!(vf, i, r.fracPart)
+ qsetelt!(vp, i, r.polyPart)
ff := represents(vf, w := integralBasis())
h := HermiteIntegrate(ff, derivation)
p := represents(map(convert(#1)@QF, vp)$VectorFunctions2(GP, QF), w)
@@ -262,7 +262,7 @@ AlgebraicIntegrate(R0, F, UP, UPUP, R): Exports == Implementation where
-- where the ri's are rational numbers, and fc(z) is arbitrary
-- (fc can be linear too)
-- la = [b1....,bk] (all rational residues)
- la := [- coefficient(q.factor, 0) for q in remove_!(fc::FAC, lf)]
+ la := [- coefficient(q.factor, 0) for q in remove!(fc::FAC, lf)]
-- ld = [D1,...,Dk] where Di is the sum of places where f has residue bi
ld := [divisor(rec.num, rec.den, rec.derivden, rec.gd, b::F) for b in la]
pp := UPQ2F(fc.factor)
diff --git a/src/algebra/intaux.spad.pamphlet b/src/algebra/intaux.spad.pamphlet
index ada00a28..2025a954 100644
--- a/src/algebra/intaux.spad.pamphlet
+++ b/src/algebra/intaux.spad.pamphlet
@@ -109,7 +109,7 @@ IntegrationResult(F:Field): Exports == Implementation where
sum(logandp, coeffp)
nesimp l ==
- [[u,x] for x in removeDuplicates_!([ne.intvar for ne in l]$List(F))
+ [[u,x] for x in removeDuplicates!([ne.intvar for ne in l]$List(F))
| (u := neselect(l, x)) ~= 0]
if (F has LiouvillianFunctionCategory) and (F has RetractableTo Symbol) then
@@ -168,7 +168,7 @@ IntegrationResult(F:Field): Exports == Implementation where
coerce(u:%):O ==
(r := retractIfCan u) case F => r::F::O
- l := reverse_! [LOG2O f for f in logpart u]$List(O)
+ l := reverse! [LOG2O f for f in logpart u]$List(O)
if ratpart u ~= 0 then l := concat(ratpart(u)::O, l)
if not elem? u then l := concat([NE2O f for f in notelem u], l)
null l => 0::O
diff --git a/src/algebra/intclos.spad.pamphlet b/src/algebra/intclos.spad.pamphlet
index 7507efae..b8190fc9 100644
--- a/src/algebra/intclos.spad.pamphlet
+++ b/src/algebra/intclos.spad.pamphlet
@@ -53,10 +53,10 @@ TriangularMatrixOperations(R,Row,Col,M): Exports == Implementation where
offset := minColIndex AI - minRowIndex AI
for i in minRowIndex AI .. maxRowIndex AI
for j in minColIndex AI .. maxColIndex AI repeat
- qsetelt_!(AI,i,j,(denom exquo qelt(A,i,j))::R)
+ qsetelt!(AI,i,j,(denom exquo qelt(A,i,j))::R)
for i in minRowIndex AI .. maxRowIndex AI repeat
for j in offset + i + 1 .. maxColIndex AI repeat
- qsetelt_!(AI,i,j, - (((+/[qelt(AI,i,k) * qelt(A,k-offset,j)
+ qsetelt!(AI,i,j, - (((+/[qelt(AI,i,k) * qelt(A,k-offset,j)
for k in i+offset..(j-1)])
exquo qelt(A, j-offset, j))::R))
AI
@@ -66,10 +66,10 @@ TriangularMatrixOperations(R,Row,Col,M): Exports == Implementation where
offset := minColIndex AI - minRowIndex AI
for i in minRowIndex AI .. maxRowIndex AI
for j in minColIndex AI .. maxColIndex AI repeat
- qsetelt_!(AI,i,j,(denom exquo qelt(A,i,j))::R)
+ qsetelt!(AI,i,j,(denom exquo qelt(A,i,j))::R)
for i in minColIndex AI .. maxColIndex AI repeat
for j in i - offset + 1 .. maxRowIndex AI repeat
- qsetelt_!(AI,j,i, - (((+/[qelt(A,j,k+offset) * qelt(AI,k,i)
+ qsetelt!(AI,j,i, - (((+/[qelt(A,j,k+offset) * qelt(AI,k,i)
for k in i-offset..(j-1)])
exquo qelt(A, j, j+offset))::R))
AI
@@ -108,7 +108,7 @@ IntegralBasisTools(R,UP,F): Exports == Implementation where
++ matrixGcd(mat,sing,n) is \spad{gcd(sing,g)} where \spad{g} is the
++ gcd of the entries of the \spad{n}-by-\spad{n} upper-triangular
++ matrix \spad{mat}.
- divideIfCan_!: (Matrix R,Matrix R,R,Integer) -> R
+ divideIfCan!: (Matrix R,Matrix R,R,Integer) -> R
++ divideIfCan!(matrix,matrixOut,prime,n) attempts to divide the
++ entries of \spad{matrix} by \spad{prime} and store the result in
++ \spad{matrixOut}. If it is successful, 1 is returned and if not,
@@ -161,13 +161,13 @@ IntegralBasisTools(R,UP,F): Exports == Implementation where
one? d => return d
d
- divideIfCan_!(matrix,matrixOut,prime,n) ==
+ divideIfCan!(matrix,matrixOut,prime,n) ==
-- note: both 'matrix' and 'matrixOut' will be upper triangular;
-- no need to do anything below the diagonal
for i in 1..n repeat
for j in i..n repeat
(a := (qelt(matrix,i,j) exquo prime)) case "failed" => return prime
- qsetelt_!(matrixOut,i,j,a :: R)
+ qsetelt!(matrixOut,i,j,a :: R)
1
leastPower(p,n) ==
@@ -444,8 +444,8 @@ WildFunctionFieldIntegralBasis(K,R,UP,F): Exports == Implementation where
bi : F := 0
for j in 1..n repeat
bi := bi + qelt(rb,i,j) * qelt(standardBasis,j)
- qsetelt_!(bas,i,bi)
- qsetelt_!(pows,i,bi ** p)
+ qsetelt!(bas,i,bi)
+ qsetelt!(pows,i,bi ** p)
coor0 := transpose coordinates(pows,bas)
denPow := rbden ** ((p - 1) :: NNI)
(coMat0 := coor0 exquo denPow) case "failed" =>
@@ -463,15 +463,15 @@ WildFunctionFieldIntegralBasis(K,R,UP,F): Exports == Implementation where
frob := copy pPows; tmpMat : Matrix sae := new(n,n,0)
for r in 2..leastPower(p,q) repeat
for i in 1..n repeat for j in 1..n repeat
- qsetelt_!(tmpMat,i,j,qelt(frob,i,j) ** p)
- times_!(frob,pPows,tmpMat)$MATSTOR(sae)
+ qsetelt!(tmpMat,i,j,qelt(frob,i,j) ** p)
+ times!(frob,pPows,tmpMat)$MATSTOR(sae)
frobPow := frob ** lp
-- compute the p-radical
ns := nullSpace frobPow
- for i in 1..n repeat for j in 1..n repeat qsetelt_!(tfm,i,j,0)
+ for i in 1..n repeat for j in 1..n repeat qsetelt!(tfm,i,j,0)
for vec in ns for i in 1.. repeat
for j in 1..n repeat
- qsetelt_!(tfm,i,j,lift qelt(vec,j))
+ qsetelt!(tfm,i,j,lift qelt(vec,j))
id := squareTop rowEchelon(tfm,prime)
-- id = basis matrix of the p-radical
idinv := UpTriBddDenomInv(id, prime)
@@ -480,7 +480,7 @@ WildFunctionFieldIntegralBasis(K,R,UP,F): Exports == Implementation where
rbinv := idealiser(id * rb, rbinv * idinv, prime * rbden)
index := diagonalProduct rbinv
rb := rowEchelon LowTriBddDenomInv(rbinv,rbden * prime)
- if divideIfCan_!(rb,matrixOut,prime,n) = 1
+ if divideIfCan!(rb,matrixOut,prime,n) = 1
then rb := matrixOut
else rbden := rbden * prime
rbinv := UpTriBddDenomInv(rb,rbden)
@@ -620,7 +620,7 @@ NumberFieldIntegralBasis(UP,F): Exports == Implementation where
for j in minIndex(b)..maxIndex(b)
for jj in minColIndex(rb)..maxColIndex(rb) repeat
a := a + qelt(rb,ii,jj) * qelt(b,j)
- qsetelt_!(v,i,a**p)
+ qsetelt!(v,i,a**p)
mat := transpose coordinates v
((transpose(rbinv) * mat) exquo (rbden ** p)) :: Mat
@@ -746,7 +746,7 @@ NumberFieldIntegralBasis(UP,F): Exports == Implementation where
rbinv := idealiser(id * rb, rbinv * idinv, p * rbden)
index := diagonalProduct rbinv
rb := rowEchelon LowTriBddDenomInv(rbinv, p * rbden)
- if divideIfCan_!(rb,matrixOut,p,n) = 1
+ if divideIfCan!(rb,matrixOut,p,n) = 1
then rb := matrixOut
else rbden := p * rbden
rbinv := UpTriBddDenomInv(rb, rbden)
diff --git a/src/algebra/intfact.spad.pamphlet b/src/algebra/intfact.spad.pamphlet
index a1e08c3b..f12bf58f 100644
--- a/src/algebra/intfact.spad.pamphlet
+++ b/src/algebra/intfact.spad.pamphlet
@@ -101,7 +101,7 @@ IntegerPrimesPackage(I:IntegerNumberSystem): with
if even? m then m := m + 1
ll:List(I) := [k::I for k in
convert(m)@Integer..convert(n)@Integer by 2 | prime?(k::I)]
- reverse_! concat_!(ll, l)
+ reverse! concat!(ll, l)
rabinProvesComposite : (I,I,I,I,NonNegativeInteger) -> Boolean
rabinProvesCompositeSmall : (I,I,I,I,NonNegativeInteger) -> Boolean
@@ -383,8 +383,8 @@ IntegerFactorizationPackage(I): Exports == Implementation where
y :=
one?(m:= unit x) => factorList x
(v := perfectSqrt m) case I =>
- concat_!(factorList x, ["sqfr",v,2]$FFE)
- concat_!(factorList x, ["sqfr",m,1]$FFE)
+ concat!(factorList x, ["sqfr",v,2]$FFE)
+ concat!(factorList x, ["sqfr",m,1]$FFE)
makeFR(u, y)
-- Pfun(y: I,n: I): I == (y**2 + 5) rem n
@@ -447,18 +447,18 @@ IntegerFactorizationPackage(I): Exports == Implementation where
BasicSieve(r, lim) ==
l:List(I) :=
[1::I,2::I,2::I,4::I,2::I,4::I,2::I,4::I,6::I,2::I,6::I]
- concat_!(l, rest(l, 3))
+ concat!(l, rest(l, 3))
d := 2::I
n := r
ls := empty()$List(FFE)
for s in l repeat
d > lim => return makeFR(n, ls)
if n<d*d then
- if n>1 then ls := concat_!(ls, ["prime",n,1]$FFE)
+ if n>1 then ls := concat!(ls, ["prime",n,1]$FFE)
return makeFR(1, ls)
m : Integer
for m in 0.. while zero?(n rem d) repeat n := n quo d
- if m>0 then ls := concat_!(ls, ["prime",d,convert m]$FFE)
+ if m>0 then ls := concat!(ls, ["prime",d,convert m]$FFE)
d := d+s
BasicMethod n ==
@@ -479,36 +479,36 @@ IntegerFactorizationPackage(I): Exports == Implementation where
a:LMI := dictionary() -- numbers yet to be factored
b:LMI := dictionary() -- prime factors found
f:LMI := dictionary() -- number which could not be factored
- insert_!(n, a)
+ insert!(n, a)
while not empty? a repeat
n := inspect a;
c := count(n, a);
- remove_!(n, a)
- prime?(n)$IntegerPrimesPackage(I) => insert_!(n, b, c)
+ remove!(n, a)
+ prime?(n)$IntegerPrimesPackage(I) => insert!(n, b, c)
-- test for a perfect power
(s := perfectNthRoot n).exponent > 1 =>
- insert_!(s.base, a, c * s.exponent)
+ insert!(s.base, a, c * s.exponent)
-- test for a difference of square
x:=approxSqrt n;
if (x**2<n) then x:=x+1
(y:=perfectSqrt (x**2-n)) case I =>
- insert_!(x+y,a,c)
- insert_!(x-y,a,c)
+ insert!(x+y,a,c)
+ insert!(x-y,a,c)
(d := PollardSmallFactor20 n) case I =>
m' : NonNegativeInteger
for m' in 0.. while zero?(n rem d) repeat n := n quo d
- insert_!(d, a, m' * c)
- if n > 1 then insert_!(n, a, c)
+ insert!(d, a, m' * c)
+ if n > 1 then insert!(n, a, c)
-- an elliptic curve factorization attempt should be made here
- insert_!(n, f, c)
+ insert!(n, f, c)
-- insert prime factors found
while not empty? b repeat
- n := inspect b; c := count(n, b); remove_!(n, b)
- flb := concat_!(flb, ["prime",n,convert c]$FFE)
+ n := inspect b; c := count(n, b); remove!(n, b)
+ flb := concat!(flb, ["prime",n,convert c]$FFE)
-- insert non-prime factors found
while not empty? f repeat
- n := inspect f; c := count(n, f); remove_!(n, f)
- flb := concat_!(flb, ["nil",n,convert c]$FFE)
+ n := inspect f; c := count(n, f); remove!(n, f)
+ flb := concat!(flb, ["nil",n,convert c]$FFE)
makeFR(u, flb)
@
diff --git a/src/algebra/intpm.spad.pamphlet b/src/algebra/intpm.spad.pamphlet
index 3ac33ab1..1c3bdad3 100644
--- a/src/algebra/intpm.spad.pamphlet
+++ b/src/algebra/intpm.spad.pamphlet
@@ -179,7 +179,7 @@ PatternMatchIntegration(R, F): Exports == Implementation where
matchdilog(f, x) ==
n := numer f
df := (d := denom f)::F
- for k in select_!(gooddilog?(#1, n, d), variables n)$List(K) repeat
+ for k in select!(gooddilog?(#1, n, d), variables n)$List(K) repeat
not empty?(l := matchdilog0(f, k, x, n, df)) => return l
empty()
@@ -197,7 +197,7 @@ PatternMatchIntegration(R, F): Exports == Implementation where
-- returns [u,d,v] or []
matchli(f, x) ==
d := denom f
- for k in select_!(goodlilog?(#1, d), variables d)$List(K) repeat
+ for k in select!(goodlilog?(#1, d), variables d)$List(K) repeat
not empty?(l := matchli0(f, k, x)) => return l
empty()
diff --git a/src/algebra/intrf.spad.pamphlet b/src/algebra/intrf.spad.pamphlet
index ae261643..030fc34c 100644
--- a/src/algebra/intrf.spad.pamphlet
+++ b/src/algebra/intrf.spad.pamphlet
@@ -531,8 +531,8 @@ TranscendentalIntegration(F, UP): Exports == Implementation where
m:Matrix(F) := zero(rows, cols := 1 + #l1)
for i in 0..rows-1 repeat
for pp in l1 for j in minColIndex m .. maxColIndex m - 1 repeat
- qsetelt_!(m, i + minRowIndex m, j, coefficient(pp.contrib, i))
- qsetelt_!(m,i+minRowIndex m, maxColIndex m, coefficient(num, i))
+ qsetelt!(m, i + minRowIndex m, j, coefficient(pp.contrib, i))
+ qsetelt!(m,i+minRowIndex m, maxColIndex m, coefficient(num, i))
m := rowEchelon m
ans := empty()$LLG
for i in minRowIndex m .. maxRowIndex m |
diff --git a/src/algebra/laurent.spad.pamphlet b/src/algebra/laurent.spad.pamphlet
index eba51897..51cafff1 100644
--- a/src/algebra/laurent.spad.pamphlet
+++ b/src/algebra/laurent.spad.pamphlet
@@ -517,7 +517,7 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
eq?(uu,rst uu) and frst uu = 0 => l
concat(prefix("O" :: OUT,[xxx ** ((n :: I) + m) :: OUT]),l)
empty? l => (0$Coef) :: OUT
- reduce("+",reverse_! l)
+ reduce("+",reverse! l)
coerce(x:%):OUT ==
x := removeZeroes(_$streamCount$Lisp,x)
diff --git a/src/algebra/lingrob.spad.pamphlet b/src/algebra/lingrob.spad.pamphlet
index 9993e249..1ac325df 100644
--- a/src/algebra/lingrob.spad.pamphlet
+++ b/src/algebra/lingrob.spad.pamphlet
@@ -145,7 +145,7 @@ LinGroebnerPackage(lv,F) : C == T
ltresult:=concat(antc-reductum antc,ltresult)
else
pivots(i) := j
- setRow_!(linmat,i,lm)
+ setRow!(linmat,i,lm)
i:=i+1
nBasis:=cons(firstmon,nBasis)
result
@@ -191,7 +191,7 @@ LinGroebnerPackage(lv,F) : C == T
g:=g+lm(k) * nvp**((k-ndim1):NNI)
primitivePart g
pivots(i) := j
- setRow_!(linmat,i,lm)
+ setRow!(linmat,i,lm)
----- transform a DPoly in a HDPoly -----
transform(dpol:DPoly) : HDPoly ==
@@ -301,7 +301,7 @@ LinGroebnerPackage(lv,F) : C == T
ltresult:=concat(antc-reductum antc,ltresult)
else
pivots(i) := j
- setRow_!(linmat,i,lm)
+ setRow!(linmat,i,lm)
i:=i+1
nBasis:=concat(firstmon,nBasis)
[result,rval]$LVals
diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet
index c14d11b3..eb4ab4d3 100644
--- a/src/algebra/list.spad.pamphlet
+++ b/src/algebra/list.spad.pamphlet
@@ -69,13 +69,13 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
empty? x == NULL(x)$Lisp
rest x == CDR(x)$Lisp
elt(x,"rest") == CDR(x)$Lisp
- setfirst_!(x,s) ==
+ setfirst!(x,s) ==
empty? x => error "Cannot update an empty list"
Qfirst RPLACA(x,s)$Lisp
setelt(x,"first",s) ==
empty? x => error "Cannot update an empty list"
Qfirst RPLACA(x,s)$Lisp
- setrest_!(x,y) ==
+ setrest!(x,y) ==
empty? x => error "Cannot update an empty list"
Qrest RPLACD(x,y)$Lisp
setelt(x,"rest",y) ==
@@ -83,7 +83,7 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
Qrest RPLACD(x,y)$Lisp
construct l == l pretend %
parts s == s pretend List S
- reverse_! x == NREVERSE(x)$Lisp
+ reverse! x == NREVERSE(x)$Lisp
reverse x == REVERSE(x)$Lisp
minIndex x == mn
@@ -109,14 +109,14 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
while Qneq(x, s) repeat
y := concat((first x)::OutputForm, y)
x := rest x
- y := reverse_! y
+ y := reverse! y
empty? s => bracket y
-- cyclic case: z is cylic part
z := list((first x)::OutputForm)
while Qneq(s, rest x) repeat
x := rest x
z := concat((first x)::OutputForm, z)
- bracket concat_!(y, overbar commaSeparate reverse_! z)
+ bracket concat!(y, overbar commaSeparate reverse! z)
if S has SetCategory then
x = y ==
@@ -142,7 +142,7 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
-- Lots of code from parts of AGGCAT, repeated here to
-- get faster compilation
- concat_!(x:%,y:%) ==
+ concat!(x:%,y:%) ==
Qnull x =>
Qnull y => x
Qpush(first y,x)
@@ -156,10 +156,10 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
-- Then a quicky:
if S has SetCategory then
- removeDuplicates_! l ==
+ removeDuplicates! l ==
p := l
while not Qnull p repeat
--- p := setrest_!(p, remove_!(#1 = Qfirst p, Qrest p))
+-- p := setrest!(p, remove!(#1 = Qfirst p, Qrest p))
-- far too expensive - builds closures etc.
pp:=p
f:S:=Qfirst p
@@ -172,9 +172,9 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
-- then sorting
mergeSort: ((S, S) -> Boolean, %, Integer) -> %
- sort_!(f, l) == mergeSort(f, l, #l)
+ sort!(f, l) == mergeSort(f, l, #l)
- merge_!(f, p, q) ==
+ merge!(f, p, q) ==
Qnull p => q
Qnull q => p
Qeq(p, q) => error "cannot merge a list into itself"
@@ -188,7 +188,7 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
QRPLACD(t, if Qnull p then q else p)$Lisp
r
- split_!(p, n) ==
+ split!(p, n) ==
n < 1 => error "index out of range"
p := rest(p, (n - 1)::NonNegativeInteger)
q := Qrest p
@@ -196,13 +196,13 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
q
mergeSort(f, p, n) ==
- if n = 2 and f(first rest p, first p) then p := reverse_! p
+ if n = 2 and f(first rest p, first p) then p := reverse! p
n < 3 => p
l := (n quo 2)::NonNegativeInteger
- q := split_!(p, l)
+ q := split!(p, l)
p := mergeSort(f, p, l)
q := mergeSort(f, q, n - l)
- merge_!(f, p, q)
+ merge!(f, p, q)
@
@@ -570,8 +570,8 @@ AssociationList(Key:SetCategory, Entry:SetCategory):
first(t:%):Pair == first deref t
rest t == ref rest deref t
concat(p:Pair, t:%) == ref concat(p, deref t)
- setrest_!(a:%, b:%) == ref setrest_!(deref a, deref b)
- setfirst_!(a:%, p:Pair) == setfirst_!(deref a,p)
+ setrest!(a:%, b:%) == ref setrest!(deref a, deref b)
+ setfirst!(a:%, p:Pair) == setfirst!(deref a,p)
minIndex(a:%):Integer == minIndex(deref a)
maxIndex(a:%):Integer == maxIndex(deref a)
@@ -604,7 +604,7 @@ AssociationList(Key:SetCategory, Entry:SetCategory):
setref(t, concat([k, e], deref t))
e
- remove_!(k:Key, t:%) ==
+ remove!(k:Key, t:%) ==
empty?(l := deref t) => "failed"
k = first(l).key =>
setref(t, rest l)
@@ -615,7 +615,7 @@ AssociationList(Key:SetCategory, Entry:SetCategory):
prev := curr
curr := rest curr
empty? curr => "failed"
- setrest_!(prev, rest curr)
+ setrest!(prev, rest curr)
first(curr).entry
@
diff --git a/src/algebra/lmdict.spad.pamphlet b/src/algebra/lmdict.spad.pamphlet
index 1d8cc8a1..edadf2f2 100644
--- a/src/algebra/lmdict.spad.pamphlet
+++ b/src/algebra/lmdict.spad.pamphlet
@@ -61,7 +61,7 @@ ListMultiDictionary(S:SetCategory): MultiDictionary(S) with
dictionary(ls:List S):% ==
empty? ls => empty()
lmd := empty()
- for x in ls repeat insert_!(x,lmd)
+ for x in ls repeat insert!(x,lmd)
lmd
if S has ConvertibleTo InputForm then
@@ -70,18 +70,18 @@ ListMultiDictionary(S:SetCategory): MultiDictionary(S) with
convert(parts lmd)@InputForm]
map(f, s) == dictionary map(f, parts s)
- map_!(f, s) == dictionary map_!(f, parts s)
+ map!(f, s) == dictionary map!(f, parts s)
parts 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)
+ 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
+ removeDuplicates! s == dictionary removeDuplicates! parts s
inspect s ==
empty? s => error "empty dictionary"
first parts s
- extract_! s ==
+ extract! s ==
empty? s => error "empty dictionary"
x := first(p := parts s)
setref(s, rest p)
@@ -96,11 +96,11 @@ ListMultiDictionary(S:SetCategory): MultiDictionary(S) with
q := rest q
false
- remove_!(p: S->Boolean, lmd:%):% ==
- for x in removeDuplicates parts lmd | p(x) repeat remove_!(x,lmd)
+ remove!(p: S->Boolean, lmd:%):% ==
+ for x in removeDuplicates parts lmd | p(x) repeat remove!(x,lmd)
lmd
- select_!(p: S->Boolean, lmd:%):% == remove_!(not p(#1), lmd)
+ select!(p: S->Boolean, lmd:%):% == remove!(not p(#1), lmd)
duplicates(lmd:%):List D ==
ld: List D := empty()
@@ -112,7 +112,7 @@ ListMultiDictionary(S:SetCategory): MultiDictionary(S) with
if S has OrderedSet then
s = t == parts s = parts t
- remove_!(x:S, s:%) ==
+ remove!(x:S, s:%) ==
p := deref s
while not empty? p and x = first p repeat p := rest p
setref(s, p)
@@ -123,7 +123,7 @@ ListMultiDictionary(S:SetCategory): MultiDictionary(S) with
p.rest := q
s
- insert_!(x, s) ==
+ insert!(x, s) ==
p := deref s
empty? p or x < first p =>
setref(s, concat(x, p))
@@ -134,17 +134,17 @@ ListMultiDictionary(S:SetCategory): MultiDictionary(S) with
s
else
- remove_!(x:S, s:%) == (setref(s, remove_!(x, parts s)); s)
+ remove!(x:S, s:%) == (setref(s, remove!(x, parts s)); s)
s = t ==
a := copy s
while not empty? a repeat
x := inspect a
count(x, s) ~= count(x, t) => return false
- remove_!(x, a)
+ remove!(x, a)
true
- insert_!(x, s) ==
+ insert!(x, s) ==
p := deref s
while not empty? p repeat
x = first p =>
diff --git a/src/algebra/lodo.spad.pamphlet b/src/algebra/lodo.spad.pamphlet
index dbf0cdbc..c5bdff2f 100644
--- a/src/algebra/lodo.spad.pamphlet
+++ b/src/algebra/lodo.spad.pamphlet
@@ -143,7 +143,7 @@ LinearOrdinaryDifferentialOperatorsOps(A, L): Exports == Implementation where
(sol := find(nonTrivial?, l := nullSpace mat)) case Vector(A) =>
return vec2LODO(sol::Vector(A))
u := eval(differentiate(u, diff), lvar, lval)
- lu := concat_!(lu, [u])
+ lu := concat!(lu, [u])
error "killer: no linear dependence found"
symmetricProduct(l1, l2, diff) ==
diff --git a/src/algebra/lodof.spad.pamphlet b/src/algebra/lodof.spad.pamphlet
index 171909b4..50e98b91 100644
--- a/src/algebra/lodof.spad.pamphlet
+++ b/src/algebra/lodof.spad.pamphlet
@@ -78,7 +78,7 @@ SetOfMIntegersInOneToN(m, n): Exports == Implementation where
l := enum((p - 1)::N, q1, n)
if empty? l then l := [new(n, false)$Bits]
for s in l repeat s.q := true
- concat_!(enum(p, q1, n), l)
+ concat!(enum(p, q1, n), l)
size() ==
if zero? sz() then
@@ -116,7 +116,7 @@ SetOfMIntegersInOneToN(m, n): Exports == Implementation where
l := concat(i, l)
found := found + 1
i := i + 1
- reverse_! l
+ reverse! l
incrementKthElement(s, k) ==
b := s.bits
@@ -316,7 +316,7 @@ AssociatedEquations(R, L):Exports == Implementation where
else
u := incrementKthElement(wi, m)$S
if u case S then eq(lookup(u::S)) := 1
- setRow_!(M, i, eq)
+ setRow!(M, i, eq)
[M, ww]
uncouplingMatrices m ==
@@ -436,7 +436,7 @@ LinearOrdinaryDifferentialOperatorFactorizer(F, UP): Exports == Impl where
degree r > 1 or not one? leadingCoefficient r =>
recurfactor(op, r, zeros, ezfactor, adj?)
op1 := opeval(op, dd - coefficient(r, 0)::L)
- map_!(opeval(#1, r), recurfactor(op1, dd, zeros, ezfactor, adj?))
+ map!(opeval(#1, r), recurfactor(op1, dd, zeros, ezfactor, adj?))
-- r1? is true means look for 1st-order right-factor also
innerFactor(l, zeros, ezfactor, r1?) ==
@@ -444,7 +444,7 @@ LinearOrdinaryDifferentialOperatorFactorizer(F, UP): Exports == Impl where
ll := adjoint l
for i in 1..(n quo 2) repeat
(r1? or (i > 1)) and ((u := rightFactor(l,i,zeros,ezfactor)) case L) =>
- return concat_!(rfactor(l, u::L, zeros, ezfactor, false), u::L)
+ return concat!(rfactor(l, u::L, zeros, ezfactor, false), u::L)
(2 * i < n) and ((u := rightFactor(ll, i, zeros, ezfactor)) case L) =>
return concat(adjoint(u::L), rfactor(ll, u::L, zeros,ezfactor,true))
[l]
diff --git a/src/algebra/manip.spad.pamphlet b/src/algebra/manip.spad.pamphlet
index eaf5fafc..b41674da 100644
--- a/src/algebra/manip.spad.pamphlet
+++ b/src/algebra/manip.spad.pamphlet
@@ -43,7 +43,7 @@ FactoredFunctions(M:IntegralDomain): Exports == Implementation where
qr := divide(term.exponent::N quo d, n)
coeff := coeff * term.factor ** qr.quotient
not zero?(qr.remainder) =>
- radi := concat_!(radi, term.factor ** qr.remainder)
+ radi := concat!(radi, term.factor ** qr.remainder)
[n, coeff, radi]
log ff ==
@@ -282,7 +282,7 @@ AlgebraicManipulations(R, F): Exports == Implementation where
-- all the kernels in ll must be algebraic
innerRF(x, ll) ==
- empty?(l := sort_!(#1 > #2, kernels x)$List(K)) or
+ empty?(l := sort!(#1 > #2, kernels x)$List(K)) or
empty? setIntersection(ll, tower x) => x
lk := empty()$List(K)
k : K
diff --git a/src/algebra/matcat.spad.pamphlet b/src/algebra/matcat.spad.pamphlet
index 0be83d9a..4b53af07 100644
--- a/src/algebra/matcat.spad.pamphlet
+++ b/src/algebra/matcat.spad.pamphlet
@@ -126,17 +126,17 @@ MatrixCategory(R,Row,Col): Category == Definition where
++ If y is \spad{m}-by-\spad{n}, \spad{rowList = [i<1>,i<2>,...,i<m>]}
++ and \spad{colList = [j<1>,j<2>,...,j<n>]}, then \spad{x(i<k>,j<l>)}
++ is set to \spad{y(k,l)} for \spad{k = 1,...,m} and \spad{l = 1,...,n}.
- swapRows_!: (%,Integer,Integer) -> %
+ swapRows!: (%,Integer,Integer) -> %
++ \spad{swapRows!(m,i,j)} interchanges the \spad{i}th and \spad{j}th
++ rows of m. This destructively alters the matrix.
- swapColumns_!: (%,Integer,Integer) -> %
+ swapColumns!: (%,Integer,Integer) -> %
++ \spad{swapColumns!(m,i,j)} interchanges the \spad{i}th and \spad{j}th
++ columns of m. This destructively alters the matrix.
subMatrix: (%,Integer,Integer,Integer,Integer) -> %
++ \spad{subMatrix(x,i1,i2,j1,j2)} extracts the submatrix
++ \spad{[x(i,j)]} where the index i ranges from \spad{i1} to \spad{i2}
++ and the index j ranges from \spad{j1} to \spad{j2}.
- setsubMatrix_!: (%,Integer,Integer,%) -> %
+ setsubMatrix!: (%,Integer,Integer,%) -> %
++ \spad{setsubMatrix(x,i1,j1,y)} destructively alters the
++ matrix x. Here \spad{x(i,j)} is set to \spad{y(i-i1+1,j-j1+1)} for
++ \spad{i = i1,...,i1-1+nrows y} and \spad{j = j1,...,j1-1+ncols y}.
@@ -261,19 +261,19 @@ MatrixCategory(R,Row,Col): Category == Definition where
ans := new(rows,cols,0)
for i in minr(ans)..maxr(ans) for ll in l repeat
for j in minc(ans)..maxc(ans) for r in ll repeat
- qsetelt_!(ans,i,j,r)
+ qsetelt!(ans,i,j,r)
ans
scalarMatrix(n,r) ==
ans := zero(n,n)
for i in minr(ans)..maxr(ans) for j in minc(ans)..maxc(ans) repeat
- qsetelt_!(ans,i,j,r)
+ qsetelt!(ans,i,j,r)
ans
diagonalMatrix(l: List R) ==
n := #l; ans := zero(n,n)
for i in minr(ans)..maxr(ans) for j in minc(ans)..maxc(ans) _
- for r in l repeat qsetelt_!(ans,i,j,r)
+ for r in l repeat qsetelt!(ans,i,j,r)
ans
diagonalMatrix(list: List %) ==
@@ -288,7 +288,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
hiR := loR + nrows(mat) - 1; hiC := loC + nrows(mat) - 1
for i in loR..hiR for k in minr(mat)..maxr(mat) repeat
for j in loC..hiC for l in minc(mat)..maxc(mat) repeat
- qsetelt_!(ans,i,j,qelt(mat,k,l))
+ qsetelt!(ans,i,j,qelt(mat,k,l))
loR := hiR + 1; loC := hiC + 1
ans
@@ -296,21 +296,21 @@ MatrixCategory(R,Row,Col): Category == Definition where
x := new(#v,1,0)
one := minc(x)
for i in minr(x)..maxr(x) for k in mini(v)..maxi(v) repeat
- qsetelt_!(x,i,one,qelt(v,k))
+ qsetelt!(x,i,one,qelt(v,k))
x
transpose(v:Row) ==
x := new(1,#v,0)
one := minr(x)
for j in minc(x)..maxc(x) for k in mini(v)..maxi(v) repeat
- qsetelt_!(x,one,j,qelt(v,k))
+ qsetelt!(x,one,j,qelt(v,k))
x
transpose(x:%) ==
ans := new(ncols x,nrows x,0)
for i in minr(ans)..maxr(ans) repeat
for j in minc(ans)..maxc(ans) repeat
- qsetelt_!(ans,i,j,qelt(x,j,i))
+ qsetelt!(ans,i,j,qelt(x,j,i))
ans
squareTop x ==
@@ -319,7 +319,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
ans := new(cols,cols,0)
for i in minr(x)..(minr(x) + cols - 1) repeat
for j in minc(x)..maxc(x) repeat
- qsetelt_!(ans,i,j,qelt(x,i,j))
+ qsetelt!(ans,i,j,qelt(x,i,j))
ans
horizConcat(x,y) ==
@@ -328,10 +328,10 @@ MatrixCategory(R,Row,Col): Category == Definition where
ans := new(rows,(cols := ncols x) + ncols y,0)
for i in minr(x)..maxr(x) repeat
for j in minc(x)..maxc(x) repeat
- qsetelt_!(ans,i,j,qelt(x,i,j))
+ qsetelt!(ans,i,j,qelt(x,i,j))
for i in minr(y)..maxr(y) repeat
for j in minc(y)..maxc(y) repeat
- qsetelt_!(ans,i,j + cols,qelt(y,i,j))
+ qsetelt!(ans,i,j + cols,qelt(y,i,j))
ans
vertConcat(x,y) ==
@@ -340,10 +340,10 @@ MatrixCategory(R,Row,Col): Category == Definition where
ans := new((rows := nrows x) + nrows y,cols,0)
for i in minr(x)..maxr(x) repeat
for j in minc(x)..maxc(x) repeat
- qsetelt_!(ans,i,j,qelt(x,i,j))
+ qsetelt!(ans,i,j,qelt(x,i,j))
for i in minr(y)..maxr(y) repeat
for j in minc(y)..maxc(y) repeat
- qsetelt_!(ans,i + rows,j,qelt(y,i,j))
+ qsetelt!(ans,i + rows,j,qelt(y,i,j))
ans
--% Part extraction/assignment
@@ -357,24 +357,24 @@ MatrixCategory(R,Row,Col): Category == Definition where
ll := cons(l,ll)
ll
- swapRows_!(x,i1,i2) ==
+ swapRows!(x,i1,i2) ==
(i1 < minr(x)) or (i1 > maxr(x)) or (i2 < minr(x)) or _
(i2 > maxr(x)) => error "swapRows!: index out of range"
i1 = i2 => x
for j in minc(x)..maxc(x) repeat
r := qelt(x,i1,j)
- qsetelt_!(x,i1,j,qelt(x,i2,j))
- qsetelt_!(x,i2,j,r)
+ qsetelt!(x,i1,j,qelt(x,i2,j))
+ qsetelt!(x,i2,j,r)
x
- swapColumns_!(x,j1,j2) ==
+ swapColumns!(x,j1,j2) ==
(j1 < minc(x)) or (j1 > maxc(x)) or (j2 < minc(x)) or _
(j2 > maxc(x)) => error "swapColumns!: index out of range"
j1 = j2 => x
for i in minr(x)..maxr(x) repeat
r := qelt(x,i,j1)
- qsetelt_!(x,i,j1,qelt(x,i,j2))
- qsetelt_!(x,i,j2,r)
+ qsetelt!(x,i,j1,qelt(x,i,j2))
+ qsetelt!(x,i,j2,r)
x
elt(x:%,rowList:List Integer,colList:List Integer) ==
@@ -387,7 +387,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
y := new(# rowList,# colList,0)
for ei in rowList for i in minr(y)..maxr(y) repeat
for ej in colList for j in minc(y)..maxc(y) repeat
- qsetelt_!(y,i,j,qelt(x,ei,ej))
+ qsetelt!(y,i,j,qelt(x,ei,ej))
y
setelt(x:%,rowList:List Integer,colList:List Integer,y:%) ==
@@ -401,7 +401,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
error "setelt: matrix has bad dimensions"
for ei in rowList for i in minr(y)..maxr(y) repeat
for ej in colList for j in minc(y)..maxc(y) repeat
- qsetelt_!(x,ei,ej,qelt(y,i,j))
+ qsetelt!(x,ei,ej,qelt(y,i,j))
y
subMatrix(x,i1,i2,j1,j2) ==
@@ -416,10 +416,10 @@ MatrixCategory(R,Row,Col): Category == Definition where
y := new(rows,cols,0)
for i in minr(y)..maxr(y) for k in i1..i2 repeat
for j in minc(y)..maxc(y) for l in j1..j2 repeat
- qsetelt_!(y,i,j,qelt(x,k,l))
+ qsetelt!(y,i,j,qelt(x,k,l))
y
- setsubMatrix_!(x,i1,j1,y) ==
+ setsubMatrix!(x,i1,j1,y) ==
i2 := i1 + nrows(y) -1
j2 := j1 + ncols(y) -1
(i1 < minr(x)) or (i2 > maxr(x)) =>
@@ -428,7 +428,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
error "setsubMatrix!: inserted matrix too big, use subMatrix to restrict it"
for i in minr(y)..maxr(y) for k in i1..i2 repeat
for j in minc(y)..maxc(y) for l in j1..j2 repeat
- qsetelt_!(x,k,l,qelt(y,i,j))
+ qsetelt!(x,k,l,qelt(y,i,j))
x
--% Arithmetic
@@ -439,7 +439,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
ans := new(r,c,0)
for i in minr(x)..maxr(x) repeat
for j in minc(x)..maxc(x) repeat
- qsetelt_!(ans,i,j,qelt(x,i,j) + qelt(y,i,j))
+ qsetelt!(ans,i,j,qelt(x,i,j) + qelt(y,i,j))
ans
x - y ==
@@ -448,7 +448,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
ans := new(r,c,0)
for i in minr(x)..maxr(x) repeat
for j in minc(x)..maxc(x) repeat
- qsetelt_!(ans,i,j,qelt(x,i,j) - qelt(y,i,j))
+ qsetelt!(ans,i,j,qelt(x,i,j) - qelt(y,i,j))
ans
- x == map(- #1,x)
@@ -468,7 +468,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
for k in minr(y)..maxr(y) for l in minc(x)..maxc(x) repeat
sum := sum + qelt(x,i,l) * qelt(y,k,j)
sum
- qsetelt_!(ans,i,j,entry)
+ qsetelt!(ans,i,j,entry)
ans
positivePower:(%,Integer) -> %
@@ -525,7 +525,7 @@ MatrixCategory(R,Row,Col): Category == Definition where
(r := (qelt(x,i,j) exquo a)) case "failed" =>
return "failed"
r :: R
- qsetelt_!(ans,i,j,entry)
+ qsetelt!(ans,i,j,entry)
ans
if R has Field then
@@ -802,7 +802,7 @@ SquareMatrixCategory(ndim,R,Row,Col): Category == Definition where
for i in minr x .. maxr x
for j in minc x .. maxc x
for k in minIndex v .. maxIndex v repeat
- qsetelt_!(v, k, qelt(x, i, j))
+ qsetelt!(v, k, qelt(x, i, j))
directProduct v
retract(x:%):R ==
@@ -817,7 +817,7 @@ SquareMatrixCategory(ndim,R,Row,Col): Category == Definition where
ans:Matrix(Col) := new(ndim,#v,0)
for i in minr ans .. maxr ans repeat
for j in minc ans .. maxc ans repeat
- qsetelt_!(ans, i, j, column(qelt(v, j), i))
+ qsetelt!(ans, i, j, column(qelt(v, j), i))
reducedSystem ans
reducedSystem(x:Matrix %):Matrix(R) ==
diff --git a/src/algebra/matfuns.spad.pamphlet b/src/algebra/matfuns.spad.pamphlet
index d36e02e7..b191d8ff 100644
--- a/src/algebra/matfuns.spad.pamphlet
+++ b/src/algebra/matfuns.spad.pamphlet
@@ -92,17 +92,17 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
if qelt(x,k,j) ~= 0 then leave (n := k)
n = minR - 1 => "no non-zeroes"
-- put nth row in ith position
- if i ~= n then swapRows_!(x,i,n)
+ if i ~= n then swapRows!(x,i,n)
-- divide ith row by its first non-zero entry
b := inv qelt(x,i,j)
- qsetelt_!(x,i,j,1)
- for k in (j+1)..maxC repeat qsetelt_!(x,i,k,b * qelt(x,i,k))
+ qsetelt!(x,i,j,1)
+ for k in (j+1)..maxC repeat qsetelt!(x,i,k,b * qelt(x,i,k))
-- perform row operations so that jth column has only one 1
for k in minR..maxR repeat
if k ~= i and qelt(x,k,j) ~= 0 then
for k1 in (j+1)..maxC repeat
- qsetelt_!(x,k,k1,qelt(x,k,k1) - qelt(x,k,j) * qelt(x,i,k1))
- qsetelt_!(x,k,j,0)
+ qsetelt!(x,k,k1,qelt(x,k,k1) - qelt(x,k,j) * qelt(x,i,k1))
+ qsetelt!(x,k,j,0)
-- increment i
i := i + 1
x
@@ -140,7 +140,7 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
rk = 0 =>
for j in minC..maxC repeat
w : Col := new(ncol,0)
- qsetelt_!(w,j,1)
+ qsetelt!(w,j,1)
basis := cons(w,basis)
basis
-- v contains information about initial 1's in the rows of x
@@ -150,7 +150,7 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
j : Integer
for i in minR..(minR + rk - 1) repeat
for j in minC.. while qelt(x,i,j) = 0 repeat j
- qsetelt_!(v,j,i)
+ qsetelt!(v,j,i)
j := maxC; l := minR + ncol - 1
while j >= minC repeat
w : Col := new(ncol,0)
@@ -158,12 +158,12 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
-- create a basis vector with a 1 in the jth row
if qelt(v,j) = minR - 1 then
colAllZeroes?(x,j) =>
- qsetelt_!(w,l,1)
+ qsetelt!(w,l,1)
basis := cons(w,basis)
for k in minC..(j-1) for ll in minR..(l-1) repeat
if qelt(v,k) ~= minR - 1 then
- qsetelt_!(w,ll,-qelt(x,qelt(v,k),j))
- qsetelt_!(w,l,1)
+ qsetelt!(w,ll,-qelt(x,qelt(v,k),j))
+ qsetelt!(w,l,1)
basis := cons(w,basis)
j := j - 1; l := l - 1
basis
@@ -183,13 +183,13 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
for k in (i+1)..maxR repeat
qelt(x,k,j) ~= 0 => leave (rown := k)
if rown = minR - 1 then return 0
- swapRows_!(x,i,rown); ans := -ans
+ swapRows!(x,i,rown); ans := -ans
ans := qelt(x,i,j) * ans; b := -inv qelt(x,i,j)
- for l in (j+1)..maxC repeat qsetelt_!(x,i,l,b * qelt(x,i,l))
+ for l in (j+1)..maxC repeat qsetelt!(x,i,l,b * qelt(x,i,l))
for k in (i+1)..maxR repeat
if (b := qelt(x,k,j)) ~= 0 then
for l in (j+1)..maxC repeat
- qsetelt_!(x,k,l,qelt(x,k,l) + b * qelt(x,i,l))
+ qsetelt!(x,k,l,qelt(x,k,l) + b * qelt(x,i,l))
qelt(x,maxR,maxC) * ans
generalizedInverse(x) ==
@@ -227,8 +227,8 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
lmin := minColIndex AB; lmax := lmin + ndim - 1
for i in minR..maxR for k in kmin..kmax repeat
for j in minC..maxC for l in lmin..lmax repeat
- qsetelt_!(AB,k,l,qelt(x,i,j))
- qsetelt_!(AB,k,lmin + ndim + k - kmin,1)
+ qsetelt!(AB,k,l,qelt(x,i,j))
+ qsetelt!(AB,k,lmin + ndim + k - kmin,1)
AB := rowEchelon AB
elt(AB,kmax,lmax) = 0 => "failed"
subMatrix(AB,kmin,kmax,lmin + ndim,lmax + ndim)
@@ -282,7 +282,7 @@ MatrixCategoryFunctions2(R1,Row1,Col1,M1,R2,Row2,Col2,M2):_
ans : M2 := new(nrows m,ncols m,0)
for i in minr(m)..maxr(m) for k in minr(ans)..maxr(ans) repeat
for j in minc(m)..maxc(m) for l in minc(ans)..maxc(ans) repeat
- qsetelt_!(ans,k,l,f qelt(m,i,j))
+ qsetelt!(ans,k,l,f qelt(m,i,j))
ans
map(f:(R1 -> (Union(R2,"failed"))),m:M1):Union(M2,"failed") ==
@@ -290,7 +290,7 @@ MatrixCategoryFunctions2(R1,Row1,Col1,M1,R2,Row2,Col2,M2):_
for i in minr(m)..maxr(m) for k in minr(ans)..maxr(ans) repeat
for j in minc(m)..maxc(m) for l in minc(ans)..maxc(ans) repeat
(r := f qelt(m,i,j)) = "failed" => return "failed"
- qsetelt_!(ans,k,l,r::R2)
+ qsetelt!(ans,k,l,r::R2)
ans
reduce(f,m,ident) ==
@@ -350,7 +350,7 @@ RectangularMatrixCategoryFunctions2(m,n,R1,Row1,Col1,M1,R2,Row2,Col2,M2):_
ans : M2 := new(m,n,0)$Matrix(R2) pretend M2
for i in minr(mat)..maxr(mat) for k in minr(ans)..maxr(ans) repeat
for j in minc(mat)..maxc(mat) for l in minc(ans)..maxc(ans) repeat
- qsetelt_!(ans pretend Matrix R2,k,l,f qelt(mat,i,j))
+ qsetelt!(ans pretend Matrix R2,k,l,f qelt(mat,i,j))
ans
reduce(f,mat,ident) ==
@@ -525,7 +525,7 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
if qelt(x,j + minR,i + minC) ~= 0 then
ans :=
md := minorDet(x,m - 2**(j :: NonNegativeInteger),_
- concat_!(reverse rl,l),i + 1,v) *_
+ concat!(reverse rl,l),i + 1,v) *_
qelt(x,j + minR,i + minC)
pos => ans + md
ans - md
@@ -543,7 +543,7 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
new((2**ndim - 1) :: NonNegativeInteger,"uncomputed")
minR := minRowIndex x; maxC := maxColIndex x
for i in 0..n1 repeat
- qsetelt_!(v,(2**i - 1),qelt(x,i + minR,maxC))
+ qsetelt!(v,(2**i - 1),qelt(x,i + minR,maxC))
minorDet(x, 2**ndim - 2, [i for i in 0..n1], 0, v)
-- elementary operation of first kind: exchange two rows --
@@ -584,19 +584,19 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
rown := k -- found a pivot
leave
if rown > minR - 1 then
- swapRows_!(x,i,rown)
+ swapRows!(x,i,rown)
ans := -ans
(c := qelt(x,i,j)) = 0 => "next j" -- try next column
for k in (i+1)..maxR repeat
if qelt(x,k,j) = 0 then
for l in (j+1)..maxC repeat
- qsetelt_!(x,k,l,(c * qelt(x,k,l) exquo b) :: R)
+ qsetelt!(x,k,l,(c * qelt(x,k,l) exquo b) :: R)
else
pv := qelt(x,k,j)
- qsetelt_!(x,k,j,0)
+ qsetelt!(x,k,j,0)
for l in (j+1)..maxC repeat
val := c * qelt(x,k,l) - pv * qelt(x,i,l)
- qsetelt_!(x,k,l,(val exquo b) :: R)
+ qsetelt!(x,k,l,(val exquo b) :: R)
b := c
(i := i+1)>maxR => leave
if ans=-1 then
@@ -721,7 +721,7 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
n := k
xnj := xkj
n = minR - 1 => "next j"
- swapRows_!(x,i,n)
+ swapRows!(x,i,n)
for k in (i+1)..maxR repeat
qelt(x,k,j) = 0 => "next k"
aa := extendedEuclidean(qelt(x,i,j),qelt(x,k,j))
@@ -732,21 +732,21 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
for k1 in (j+1)..maxC repeat
val1 := a * qelt(x,i,k1) + b * qelt(x,k,k1)
val2 := -a1 * qelt(x,i,k1) + b1 * qelt(x,k,k1)
- qsetelt_!(x,i,k1,val1); qsetelt_!(x,k,k1,val2)
- qsetelt_!(x,i,j,d); qsetelt_!(x,k,j,0)
+ qsetelt!(x,i,k1,val1); qsetelt!(x,k,k1,val2)
+ qsetelt!(x,i,j,d); qsetelt!(x,k,j,0)
un := unitNormal qelt(x,i,j)
- qsetelt_!(x,i,j,un.canonical)
+ qsetelt!(x,i,j,un.canonical)
if un.associate ~= 1 then for jj in (j+1)..maxC repeat
- qsetelt_!(x,i,jj,un.associate * qelt(x,i,jj))
+ qsetelt!(x,i,jj,un.associate * qelt(x,i,jj))
xij := qelt(x,i,j)
for k in minR..(i-1) repeat
qelt(x,k,j) = 0 => "next k"
qr := normalizedDivide(qelt(x,k,j), xij)
- qsetelt_!(x,k,j,qr.remainder)
+ qsetelt!(x,k,j,qr.remainder)
for k1 in (j+1)..maxC repeat
- qsetelt_!(x,k,k1,qelt(x,k,k1) - qr.quotient * qelt(x,i,k1))
+ qsetelt!(x,k,k1,qelt(x,k,k1) - qr.quotient * qelt(x,i,k1))
i := i + 1
x
diff --git a/src/algebra/matrix.spad.pamphlet b/src/algebra/matrix.spad.pamphlet
index 4a63ccf5..a40de7a0 100644
--- a/src/algebra/matrix.spad.pamphlet
+++ b/src/algebra/matrix.spad.pamphlet
@@ -44,7 +44,7 @@ IndexedMatrix(R,mnRow,mnCol): Exports == Implementation where
Implementation ==>
InnerIndexedTwoDimensionalArray(R,mnRow,mnCol,Row,Col) add
- swapRows_!(x,i1,i2) ==
+ swapRows!(x,i1,i2) ==
(i1 < minRowIndex(x)) or (i1 > maxRowIndex(x)) or _
(i2 < minRowIndex(x)) or (i2 > maxRowIndex(x)) =>
error "swapRows!: index out of range"
@@ -53,8 +53,8 @@ IndexedMatrix(R,mnRow,mnCol): Exports == Implementation where
xx := x pretend PrimitiveArray(PrimitiveArray(R))
n1 := i1 - minRow; n2 := i2 - minRow
row1 := qelt(xx,n1)
- qsetelt_!(xx,n1,qelt(xx,n2))
- qsetelt_!(xx,n2,row1)
+ qsetelt!(xx,n1,qelt(xx,n2))
+ qsetelt!(xx,n2,row1)
xx pretend $
if R has commutative("*") then
@@ -138,7 +138,7 @@ Matrix(R): Exports == Implementation where
minRowIndex x == mnRow
minColIndex x == mnCol
- swapRows_!(x,i1,i2) ==
+ swapRows!(x,i1,i2) ==
(i1 < minRowIndex(x)) or (i1 > maxRowIndex(x)) or _
(i2 < minRowIndex(x)) or (i2 > maxRowIndex(x)) =>
error "swapRows!: index out of range"
@@ -147,8 +147,8 @@ Matrix(R): Exports == Implementation where
xx := x pretend PrimitiveArray(PrimitiveArray(R))
n1 := i1 - minRow; n2 := i2 - minRow
row1 := qelt(xx,n1)
- qsetelt_!(xx,n1,qelt(xx,n2))
- qsetelt_!(xx,n2,row1)
+ qsetelt!(xx,n1,qelt(xx,n2))
+ qsetelt!(xx,n2,row1)
xx pretend $
positivePower:($,Integer,NonNegativeInteger) -> $
@@ -162,7 +162,7 @@ Matrix(R): Exports == Implementation where
b := new(nn,nn,0) pretend Matrix(R)
c := new(nn,nn,0) pretend Matrix(R)
xx := x pretend Matrix(R)
- power_!(a,b,c,xx,n :: NonNegativeInteger)$MATSTOR pretend $
+ power!(a,b,c,xx,n :: NonNegativeInteger)$MATSTOR pretend $
x:$ ** n:NonNegativeInteger ==
not((nn := nrows x) = ncols x) =>
@@ -215,7 +215,7 @@ Matrix(R): Exports == Implementation where
diagonalMatrix(v: Vector R) ==
n := #v; ans := zero(n,n)
for i in minr(ans)..maxr(ans) for j in minc(ans)..maxc(ans) _
- for k in mini(v)..maxi(v) repeat qsetelt_!(ans,i,j,qelt(v,k))
+ for k in mini(v)..maxi(v) repeat qsetelt!(ans,i,j,qelt(v,k))
ans
-- diagonalMatrix(vec: Vector $) ==
@@ -305,7 +305,7 @@ RectangularMatrix(m,n,R): Exports == Implementation where
ans : Matrix R := new(m,n,0)
for i in minr(ans)..maxr(ans) for ll in l repeat
for j in minc(ans)..maxc(ans) for r in ll repeat
- qsetelt_!(ans,i,j,r)
+ qsetelt!(ans,i,j,r)
per ans
row(x,i) == directProduct row(rep x,i)
diff --git a/src/algebra/matstor.spad.pamphlet b/src/algebra/matstor.spad.pamphlet
index 5a77c5be..f88db8c8 100644
--- a/src/algebra/matstor.spad.pamphlet
+++ b/src/algebra/matstor.spad.pamphlet
@@ -36,36 +36,36 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
REP ==> PrimitiveArray PrimitiveArray R
Exports ==> with
- copy_! : (M,M) -> M
+ copy! : (M,M) -> M
++ \spad{copy!(c,a)} copies the matrix \spad{a} into the matrix c.
++ Error: if \spad{a} and c do not have the same
++ dimensions.
- plus_! : (M,M,M) -> M
+ plus! : (M,M,M) -> M
++ \spad{plus!(c,a,b)} computes the matrix sum \spad{a + b} and stores the
++ result in the matrix c.
++ Error: if \spad{a}, b, and c do not have the same dimensions.
- minus_! : (M,M) -> M
+ minus! : (M,M) -> M
++ \spad{minus!(c,a)} computes \spad{-a} and stores the result in the
++ matrix c.
++ Error: if a and c do not have the same dimensions.
- minus_! : (M,M,M) -> M
+ minus! : (M,M,M) -> M
++ \spad{!minus!(c,a,b)} computes the matrix difference \spad{a - b}
++ and stores the result in the matrix c.
++ Error: if \spad{a}, b, and c do not have the same dimensions.
- leftScalarTimes_! : (M,R,M) -> M
+ leftScalarTimes! : (M,R,M) -> M
++ \spad{leftScalarTimes!(c,r,a)} computes the scalar product
++ \spad{r * a} and stores the result in the matrix c.
++ Error: if \spad{a} and c do not have the same dimensions.
- rightScalarTimes_! : (M,M,R) -> M
+ rightScalarTimes! : (M,M,R) -> M
++ \spad{rightScalarTimes!(c,a,r)} computes the scalar product
++ \spad{a * r} and stores the result in the matrix c.
++ Error: if \spad{a} and c do not have the same dimensions.
- times_! : (M,M,M) -> M
+ times! : (M,M,M) -> M
++ \spad{times!(c,a,b)} computes the matrix product \spad{a * b}
++ and stores the result in the matrix c.
++ Error: if \spad{a}, b, and c do not have
++ compatible dimensions.
- power_! : (M,M,M,M,NNI) -> M
+ power! : (M,M,M,M,NNI) -> M
++ \spad{power!(a,b,c,m,n)} computes m ** n and stores the result in
++ \spad{a}. The matrices b and c are used to store intermediate results.
++ Error: if \spad{a}, b, c, and m are not square
@@ -79,7 +79,7 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
rep : M -> REP
rep m == m pretend REP
- copy_!(c,a) ==
+ copy!(c,a) ==
m := nrows a; n := ncols a
not((nrows c) = m and (ncols c) = n) =>
error "copy!: matrices of incompatible dimensions"
@@ -87,10 +87,10 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
for i in 0..(m-1) repeat
aRow := qelt(aa,i); cRow := qelt(cc,i)
for j in 0..(n-1) repeat
- qsetelt_!(cRow,j,qelt(aRow,j))
+ qsetelt!(cRow,j,qelt(aRow,j))
c
- plus_!(c,a,b) ==
+ plus!(c,a,b) ==
m := nrows a; n := ncols a
not((nrows b) = m and (ncols b) = n) =>
error "plus!: matrices of incompatible dimensions"
@@ -100,10 +100,10 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
for i in 0..(m-1) repeat
aRow := qelt(aa,i); bRow := qelt(bb,i); cRow := qelt(cc,i)
for j in 0..(n-1) repeat
- qsetelt_!(cRow,j,qelt(aRow,j) + qelt(bRow,j))
+ qsetelt!(cRow,j,qelt(aRow,j) + qelt(bRow,j))
c
- minus_!(c,a) ==
+ minus!(c,a) ==
m := nrows a; n := ncols a
not((nrows c) = m and (ncols c) = n) =>
error "minus!: matrices of incompatible dimensions"
@@ -111,10 +111,10 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
for i in 0..(m-1) repeat
aRow := qelt(aa,i); cRow := qelt(cc,i)
for j in 0..(n-1) repeat
- qsetelt_!(cRow,j,-qelt(aRow,j))
+ qsetelt!(cRow,j,-qelt(aRow,j))
c
- minus_!(c,a,b) ==
+ minus!(c,a,b) ==
m := nrows a; n := ncols a
not((nrows b) = m and (ncols b) = n) =>
error "minus!: matrices of incompatible dimensions"
@@ -124,10 +124,10 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
for i in 0..(m-1) repeat
aRow := qelt(aa,i); bRow := qelt(bb,i); cRow := qelt(cc,i)
for j in 0..(n-1) repeat
- qsetelt_!(cRow,j,qelt(aRow,j) - qelt(bRow,j))
+ qsetelt!(cRow,j,qelt(aRow,j) - qelt(bRow,j))
c
- leftScalarTimes_!(c,r,a) ==
+ leftScalarTimes!(c,r,a) ==
m := nrows a; n := ncols a
not((nrows c) = m and (ncols c) = n) =>
error "leftScalarTimes!: matrices of incompatible dimensions"
@@ -135,10 +135,10 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
for i in 0..(m-1) repeat
aRow := qelt(aa,i); cRow := qelt(cc,i)
for j in 0..(n-1) repeat
- qsetelt_!(cRow,j,r * qelt(aRow,j))
+ qsetelt!(cRow,j,r * qelt(aRow,j))
c
- rightScalarTimes_!(c,a,r) ==
+ rightScalarTimes!(c,a,r) ==
m := nrows a; n := ncols a
not((nrows c) = m and (ncols c) = n) =>
error "rightScalarTimes!: matrices of incompatible dimensions"
@@ -146,14 +146,14 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
for i in 0..(m-1) repeat
aRow := qelt(aa,i); cRow := qelt(cc,i)
for j in 0..(n-1) repeat
- qsetelt_!(cRow,j,qelt(aRow,j) * r)
+ qsetelt!(cRow,j,qelt(aRow,j) * r)
c
- copyCol_!: (ARR,REP,Integer,Integer) -> ARR
- copyCol_!(bCol,bb,j,n1) ==
- for i in 0..n1 repeat qsetelt_!(bCol,i,qelt(qelt(bb,i),j))
+ copyCol!: (ARR,REP,Integer,Integer) -> ARR
+ copyCol!(bCol,bb,j,n1) ==
+ for i in 0..n1 repeat qsetelt!(bCol,i,qelt(qelt(bb,i),j))
- times_!(c,a,b) ==
+ times!(c,a,b) ==
m := nrows a; n := ncols a; p := ncols b
not((nrows b) = n and (nrows c) = m and (ncols c) = p) =>
error "times!: matrices of incompatible dimensions"
@@ -161,16 +161,16 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
bCol : ARR := new(n,0)
m1 := (m :: Integer) - 1; n1 := (n :: Integer) - 1
for j in 0..(p-1) repeat
- copyCol_!(bCol,bb,j,n1)
+ copyCol!(bCol,bb,j,n1)
for i in 0..m1 repeat
aRow := qelt(aa,i); cRow := qelt(cc,i)
sum : R := 0
for k in 0..n1 repeat
sum := sum + qelt(aRow,k) * qelt(bCol,k)
- qsetelt_!(cRow,j,sum)
+ qsetelt!(cRow,j,sum)
c
- power_!(a,b,c,m,p) ==
+ power!(a,b,c,m,p) ==
mm := nrows a; nn := ncols a
not(mm = nn) =>
error "power!: matrix must be square"
@@ -181,23 +181,23 @@ StorageEfficientMatrixOperations(R): Exports == Implementation where
not((nrows m) = mm and (ncols m) = nn) =>
error "power!: matrices of incompatible dimensions"
flag := false
- copy_!(b,m)
+ copy!(b,m)
repeat
if odd? p then
flag =>
- times_!(c,b,a)
- copy_!(a,c)
+ times!(c,b,a)
+ copy!(a,c)
flag := true
- copy_!(a,b)
+ copy!(a,b)
one? p => return a
p := p quo 2
- times_!(c,b,b)
- copy_!(b,c)
+ times!(c,b,b)
+ copy!(b,c)
m ** n ==
not square? m => error "**: matrix must be square"
a := copy m; b := copy m; c := copy m
- power_!(a,b,c,m,n)
+ power!(a,b,c,m,n)
@
\section{License}
diff --git a/src/algebra/mkfunc.spad.pamphlet b/src/algebra/mkfunc.spad.pamphlet
index f53272e1..d9ecaafc 100644
--- a/src/algebra/mkfunc.spad.pamphlet
+++ b/src/algebra/mkfunc.spad.pamphlet
@@ -441,7 +441,7 @@ MakeFloatCompiledFunction(S): Exports == Implementation where
for s in l repeat
(u := mkLisp s) case "failed" => return "failed"
ans := concat(u::INF, ans)
- reverse_! ans
+ reverse! ans
mkLisp s ==
diff --git a/src/algebra/mring.spad.pamphlet b/src/algebra/mring.spad.pamphlet
index ba63134c..679cdae4 100644
--- a/src/algebra/mring.spad.pamphlet
+++ b/src/algebra/mring.spad.pamphlet
@@ -224,13 +224,13 @@ MonoidRing(R: Ring, M: Monoid): MRcategory == MRdefinition where
ta := first a; tb := first b
ra := rest a; rb := rest b
c :=
- ta.Mn > tb.Mn => (a := ra; concat_!(c, ta))
- ta.Mn < tb.Mn => (b := rb; concat_!(c, tb))
+ ta.Mn > tb.Mn => (a := ra; concat!(c, ta))
+ ta.Mn < tb.Mn => (b := rb; concat!(c, tb))
a := ra; b := rb
not zero?(r := ta.Cf+tb.Cf) =>
- concat_!(c, [r, ta.Mn])
+ concat!(c, [r, ta.Mn])
c
- concat_!(c, concat(a, b))
+ concat!(c, concat(a, b))
coefficient(a, m) ==
for t in a repeat
@@ -306,7 +306,7 @@ MonoidRing(R: Ring, M: Monoid): MRcategory == MRdefinition where
addterm(Tabl: AssociationList(M,R), r:R, m:M):R ==
(u := search(m, Tabl)) case "failed" => Tabl.m := r
- zero?(r := r + u::R) => (remove_!(m, Tabl); 0)
+ zero?(r := r + u::R) => (remove!(m, Tabl); 0)
Tabl.m := r
a + b ==
diff --git a/src/algebra/mset.spad.pamphlet b/src/algebra/mset.spad.pamphlet
index 6e6a1d44..419c2bfd 100644
--- a/src/algebra/mset.spad.pamphlet
+++ b/src/algebra/mset.spad.pamphlet
@@ -46,12 +46,12 @@ Multiset(S: SetCategory): MultisetAggregate S with
++ if \spad{number} is positive, all of them if
++ \spad{number} equals zero, and all but at most \spad{-number} if
++ \spad{number} is negative.
- remove_!: (S,%,Integer) -> %
+ remove!: (S,%,Integer) -> %
++ remove!(x,ms,number) removes destructively at most \spad{number}
++ copies of element x if \spad{number} is positive, all
++ of them if \spad{number} equals zero, and all but at most
++ \spad{-number} if \spad{number} is negative.
- remove_!: ( S -> Boolean ,%,Integer) -> %
+ remove!: ( S -> Boolean ,%,Integer) -> %
++ remove!(p,ms,number) removes destructively at most \spad{number}
++ copies of elements x such that \spad{p(x)} is
++ \spadfun{true} if \spad{number} is positive, all of them if
@@ -123,18 +123,18 @@ Multiset(S: SetCategory): MultisetAggregate S with
ld := cons([e,n::NonNegativeInteger],ld)
ld
- extract_!(ms:%):S == -- BagAggregate
+ extract!(ms:%):S == -- BagAggregate
empty? ms => error "extract: Empty multiset"
ms.count := dec ms.count
t := ms.table
e := inspect(t).key
if (n := t.e) > 1 then t.e := dec n
- else remove_!(e,t)
+ else remove!(e,t)
e
inspect(ms:%):S == inspect(ms.table).key -- BagAggregate
- insert_!(e:S,ms:%):% == -- BagAggregate
+ insert!(e:S,ms:%):% == -- BagAggregate
ms.count := inc ms.count
ms.table.e := inc ms.table.e
ms
@@ -147,12 +147,12 @@ Multiset(S: SetCategory): MultisetAggregate S with
count(e:S, ms:%):NonNegativeInteger == ms.table.e::NonNegativeInteger
- remove_!(e:S, ms:%, max:Integer):% ==
- zero? max => remove_!(e,ms)
+ remove!(e:S, ms:%, max:Integer):% ==
+ zero? max => remove!(e,ms)
t := ms.table
if member?(e, keys t) then
((n := t.e) <= max) =>
- remove_!(e,t)
+ remove!(e,t)
ms.count := ms.count-n
max > 0 =>
t.e := n-max
@@ -162,12 +162,12 @@ Multiset(S: SetCategory): MultisetAggregate S with
ms.count := ms.count-n
ms
- remove_!(p: S -> Boolean, ms:%, max:Integer):% ==
- zero? max => remove_!(p,ms)
+ remove!(p: S -> Boolean, ms:%, max:Integer):% ==
+ zero? max => remove!(p,ms)
t := ms.table
for e in keys t | p(e) repeat
((n := t.e) <= max) =>
- remove_!(e,t)
+ remove!(e,t)
ms.count := ms.count-n
max > 0 =>
t.e := n-max
@@ -177,49 +177,49 @@ Multiset(S: SetCategory): MultisetAggregate S with
ms.count := ms.count-n
ms
- remove(e:S, ms:%, max:Integer):% == remove_!(e, copy ms, max)
+ remove(e:S, ms:%, max:Integer):% == remove!(e, copy ms, max)
- remove(p: S -> Boolean,ms:%,max:Integer):% == remove_!(p, copy ms, max)
+ remove(p: S -> Boolean,ms:%,max:Integer):% == remove!(p, copy ms, max)
- remove_!(e:S, ms:%):% == -- DictionaryOperations
+ remove!(e:S, ms:%):% == -- DictionaryOperations
t := ms.table
if member?(e, keys t) then
ms.count := ms.count-t.e
- remove_!(e, t)
+ remove!(e, t)
ms
- remove_!(p:S ->Boolean, ms:%):% == -- DictionaryOperations
+ remove!(p:S ->Boolean, ms:%):% == -- DictionaryOperations
t := ms.table
for e in keys t | p(e) repeat
ms.count := ms.count-t.e
- remove_!(e, t)
+ remove!(e, t)
ms
- select_!(p: S -> Boolean, ms:%):% == -- DictionaryOperations
- remove_!(not p(#1), ms)
+ select!(p: S -> Boolean, ms:%):% == -- DictionaryOperations
+ remove!(not p(#1), ms)
- removeDuplicates_!(ms:%):% == -- MultiDictionary
+ removeDuplicates!(ms:%):% == -- MultiDictionary
t := ms.table
l := keys t
for e in l repeat t.e := 1
ms.count := #l
ms
- insert_!(e:S,ms:%,more:NonNegativeInteger):% == -- MultiDictionary
+ insert!(e:S,ms:%,more:NonNegativeInteger):% == -- MultiDictionary
ms.count := ms.count+more
ms.table.e := ms.table.e+more
ms
- map_!(f: S->S, ms:%):% == -- HomogeneousAggregate
+ map!(f: S->S, ms:%):% == -- HomogeneousAggregate
t := ms.table
t1 := tbl()
for e in keys t repeat
t1.f(e) := t.e
- remove_!(e, t)
+ remove!(e, t)
ms.table := t1
ms
- map(f: S -> S, ms:%):% == map_!(f, copy ms) -- HomogeneousAggregate
+ map(f: S -> S, ms:%):% == map!(f, copy ms) -- HomogeneousAggregate
parts(m:%):List S ==
l := empty()$List(S)
diff --git a/src/algebra/mts.spad.pamphlet b/src/algebra/mts.spad.pamphlet
index 517d0d74..4d46aab7 100644
--- a/src/algebra/mts.spad.pamphlet
+++ b/src/algebra/mts.spad.pamphlet
@@ -268,7 +268,7 @@ SparseMultivariateTaylorSeries(Coef,Var,SMP):_
eq?(uu,rst uu) and frst uu = 0 => l
concat(prefix("O" :: OUT,[n :: OUT]),l)
empty? l => (0$SMP) :: OUT
- reduce("+",reverse_! l)
+ reduce("+",reverse! l)
if Coef has Field then
stream(x:%):Rep == x pretend Rep
SF2==> StreamFunctions2
diff --git a/src/algebra/naalg.spad.pamphlet b/src/algebra/naalg.spad.pamphlet
index 9937d9aa..52a2e17b 100644
--- a/src/algebra/naalg.spad.pamphlet
+++ b/src/algebra/naalg.spad.pamphlet
@@ -76,7 +76,7 @@ AlgebraGivenByStructuralConstants(R:Field, n : PositiveInteger,_
m : NonNegativeInteger := (maxIndex b) :: NonNegativeInteger
transitionMatrix : Matrix R := new(n,m,0$R)$Matrix(R)
for i in 1..m repeat
- setColumn_!(transitionMatrix,i,coordinates(b.i))
+ setColumn!(transitionMatrix,i,coordinates(b.i))
res : REC := solve(transitionMatrix,coordinates(x))$LSMP
if (not every?(zero?$R,first res.basis)) then
error("coordinates: warning your 'basis' is linearly dependent")
@@ -467,7 +467,7 @@ StructuralConstantsPackage(R:Field): public == private where
n : NonNegativeInteger := nrows(b.1) * ncols(b.1)
transitionMatrix : Matrix R := new(n,m,0$R)$Matrix(R)
for i in 1..m repeat
- setColumn_!(transitionMatrix,i,matrix2Vector(b.i))
+ setColumn!(transitionMatrix,i,matrix2Vector(b.i))
res : REC := solve(transitionMatrix,matrix2Vector(x))$LSMP
if (not every?(zero?$R,first res.basis)) then
error("coordinates: the second argument is linearly dependent")
@@ -504,7 +504,7 @@ agree with number of generators"
totalDegree(p,ls) > 1 =>
error "structuralConstants: entries of second argument _
must be linear polynomials in the generators"
- if (c := coefficient(p, s, 1) ) ~= 0 then qsetelt_!(mat,i,j,c)
+ if (c := coefficient(p, s, 1) ) ~= 0 then qsetelt!(mat,i,j,c)
gamma := cons(mat, gamma)
lscopy := rest lscopy
vector reverse gamma
@@ -530,7 +530,7 @@ must be (linear) polynomials in the generators"
totalDegree(p,ls) > 1 =>
error "structuralConstants: entries of second argument _
must be linear polynomials in the generators"
- if (c := coefficient(p, s, 1) ) ~= 0 then qsetelt_!(mat,i,j,c/q)
+ if (c := coefficient(p, s, 1) ) ~= 0 then qsetelt!(mat,i,j,c/q)
gamma := cons(mat, gamma)
lscopy := rest lscopy
vector reverse gamma
diff --git a/src/algebra/naalgc.spad.pamphlet b/src/algebra/naalgc.spad.pamphlet
index 9593ca63..8992dcaa 100644
--- a/src/algebra/naalgc.spad.pamphlet
+++ b/src/algebra/naalgc.spad.pamphlet
@@ -864,7 +864,7 @@ FiniteRankNonAssociativeAlgebra(R:CommutativeRing):
coordinates(v:Vector %, b:Vector %) ==
m := new(#v, #b, 0)$Matrix(R)
for i in minIndex v .. maxIndex v for j in minRowIndex m .. repeat
- setRow_!(m, j, coordinates(qelt(v, i), b))
+ setRow!(m, j, coordinates(qelt(v, i), b))
m
represents(v, b) ==
@@ -1030,7 +1030,7 @@ FramedNonAssociativeAlgebra(R:CommutativeRing):
x : M P R := new(1,n,0)
for i in 1..n repeat
mo := monomial(1, [symbolsForCoef.i], [1])$(P R)
- qsetelt_!(x,1,i,mo)
+ qsetelt!(x,1,i,mo)
y : M P R := copy x
k : PositiveInteger := 1
cond : M P R := copy x
@@ -1063,7 +1063,7 @@ FramedNonAssociativeAlgebra(R:CommutativeRing):
x : M P R := new(1,n,0)
for i in 1..n repeat
mo := monomial(1, [symbolsForCoef.i], [1])$(P R)
- qsetelt_!(x,1,i,mo)
+ qsetelt!(x,1,i,mo)
y : M P R := copy x
k : PositiveInteger := 1
cond : M P R := copy x
@@ -1202,7 +1202,7 @@ FramedNonAssociativeAlgebra(R:CommutativeRing):
coordinates(v:Vector %) ==
m := new(#v, rank(), 0)$Matrix(R)
for i in minIndex v .. maxIndex v for j in minRowIndex m .. repeat
- setRow_!(m, j, coordinates qelt(v, i))
+ setRow!(m, j, coordinates qelt(v, i))
m
@
diff --git a/src/algebra/newpoint.spad.pamphlet b/src/algebra/newpoint.spad.pamphlet
index 9c739e1d..c742543d 100644
--- a/src/algebra/newpoint.spad.pamphlet
+++ b/src/algebra/newpoint.spad.pamphlet
@@ -341,7 +341,7 @@ SubSpace(n:PI,R:Ring) : Exports == Implementation where
momma.lastChild := momma.childrenField
momma.noChildren := 1
else
- setrest_!(lastKid,[baby])
+ setrest!(lastKid,[baby])
momma.lastChild := rest lastKid
momma.noChildren := momma.noChildren + 1
baby
@@ -372,7 +372,7 @@ SubSpace(n:PI,R:Ring) : Exports == Implementation where
cc := deepCopy c
cc.parentField := [node]
node.childrenField := cons(cc,node.childrenField)
- node.childrenField := reverse_!(node.childrenField)
+ node.childrenField := reverse!(node.childrenField)
node.lastChild := tail node.childrenField
node
@@ -412,7 +412,7 @@ SubSpace(n:PI,R:Ring) : Exports == Implementation where
space.pointDataField := [point]
space.lastPoint := space.pointDataField
else
- setrest_!(lastPt,[point])
+ setrest!(lastPt,[point])
space.lastPoint := rest lastPt
space.noPoints := space.noPoints + 1
which := space.noPoints
@@ -435,7 +435,7 @@ SubSpace(n:PI,R:Ring) : Exports == Implementation where
space.pointDataField := [point]
space.lastPoint := space.pointDataField
else
- setrest_!(lastPt,[point])
+ setrest!(lastPt,[point])
space.lastPoint := rest lastPt
space.noPoints := space.noPoints + 1
which := space.noPoints
@@ -457,7 +457,7 @@ SubSpace(n:PI,R:Ring) : Exports == Implementation where
space.pointDataField := [point]
space.lastPoint := space.pointDataField
else
- setrest_!(lastPt,[point])
+ setrest!(lastPt,[point])
space.lastPoint := rest lastPt
space.noPoints := space.noPoints + 1
which := space.noPoints
@@ -489,7 +489,7 @@ SubSpace(n:PI,R:Ring) : Exports == Implementation where
space.pointDataField := [point]
space.lastPoint := space.pointDataField
else
- setrest_!(lastPt,[point])
+ setrest!(lastPt,[point])
space.lastPoint := rest lastPt
space.noPoints := space.noPoints + 1
error "You need to pass a top level SubSpace (level should be zero)"
@@ -502,7 +502,7 @@ SubSpace(n:PI,R:Ring) : Exports == Implementation where
space.pointDataField := [point]
space.lastPoint := space.pointDataField
else
- setrest_!(lastPt,[point])
+ setrest!(lastPt,[point])
space.lastPoint := rest lastPt
space.noPoints := space.noPoints + 1
which := space.noPoints
diff --git a/src/algebra/numtheor.spad.pamphlet b/src/algebra/numtheor.spad.pamphlet
index 6954e930..4bce04db 100644
--- a/src/algebra/numtheor.spad.pamphlet
+++ b/src/algebra/numtheor.spad.pamphlet
@@ -348,7 +348,7 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where
odd? n => 0
l := (#E) :: I
n < l => E(n)
- concat_!(E, new((n+1-l)::NNI, 0)$IndexedFlexibleArray(I,0))
+ concat!(E, new((n+1-l)::NNI, 0)$IndexedFlexibleArray(I,0))
for i in 1 .. l by 2 repeat E(i) := 0
-- compute E(i) i = l+2,l+4,...,n given E(j) j = 0,2,...,i-2
t,e : I
@@ -367,7 +367,7 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where
0
l := (#B) :: I
n < l => B(n)
- concat_!(B, new((n+1-l)::NNI, 0)$IndexedFlexibleArray(RN,0))
+ concat!(B, new((n+1-l)::NNI, 0)$IndexedFlexibleArray(RN,0))
for i in 1 .. l by 2 repeat B(i) := 0
-- compute B(i) i = l+2,l+4,...,n given B(j) j = 0,2,...,i-2
for i in l+1 .. n by 2 repeat
diff --git a/src/algebra/odealg.spad.pamphlet b/src/algebra/odealg.spad.pamphlet
index 32425c96..03901c7c 100644
--- a/src/algebra/odealg.spad.pamphlet
+++ b/src/algebra/odealg.spad.pamphlet
@@ -92,7 +92,7 @@ SystemODESolver(F, LO): Exports == Implementation where
for sol in sols repeat m := m + count(#1 ~= 0, sol.basis)$List(F)
SolMatrix:MF := new(n, m, 0)
m := 0
- for sol in reverse_! sols repeat
+ for sol in reverse! sols repeat
i := i+1
er := rec.eqs.i
nn := #(er.g) -- size of active companionblock
@@ -228,8 +228,8 @@ SystemODESolver(F, LO): Exports == Implementation where
if (x(k, j) ~= 0) and ((rown = minr - 1) or
degree x(k,j) < degree x(rown,j)) then rown := k
rown = minr - 1 => "enuf"
- x := swapRows_!(x, i, rown)
- swap_!(w, i + offset, rown + offset)
+ x := swapRows!(x, i, rown)
+ swap!(w, i + offset, rown + offset)
for k in i+1 .. nrows | x(k, j) ~= 0 repeat
l := rightLcm(x(i,j), x(k,j))
a := rightQuotient(l, x(i, j))
diff --git a/src/algebra/odeef.spad.pamphlet b/src/algebra/odeef.spad.pamphlet
index 1b1cc186..5598124b 100644
--- a/src/algebra/odeef.spad.pamphlet
+++ b/src/algebra/odeef.spad.pamphlet
@@ -52,7 +52,7 @@ ReductionOfOrder(F, L): Exports == Impl where
empty? sols => [l, empty()]
neweq := ReduceOrder(l, sol := first sols)
rec := ReduceOrder(neweq, [diff(s / sol) for s in rest sols])
- [rec.eq, concat_!(rec.op, sol)]
+ [rec.eq, concat!(rec.op, sol)]
ithcoef(eq, i, s) ==
ans:F := 0
@@ -65,9 +65,9 @@ ReductionOfOrder(F, L): Exports == Impl where
ReduceOrder(eq:L, sol:F) ==
s:A := new(n := degree eq, 0) -- will contain derivatives of sol
si := sol -- will run through the derivatives
- qsetelt_!(s, 0, si)
+ qsetelt!(s, 0, si)
for i in 1..(n-1)::NonNegativeInteger repeat
- qsetelt_!(s, i, si := diff si)
+ qsetelt!(s, i, si := diff si)
ans:L := 0
for i in 0..(n-1)::NonNegativeInteger repeat
ans := ans + monomial(ithcoef(eq, i, s), i)
@@ -203,7 +203,7 @@ ElementaryFunctionLODESolver(R, F, L): Exports == Implementation where
-- xpart(f,x) removes any constant not involving x from f
xpart(f, x) ==
- l := reverse_! varselect(tower f, x)
+ l := reverse! varselect(tower f, x)
lp := [k::P for k in l]
smpxpart(numer f, x, l, lp) / smpxpart(denom f, x, l, lp)
@@ -235,14 +235,14 @@ ElementaryFunctionLODESolver(R, F, L): Exports == Implementation where
rec := ReduceOrder(oper, sols)
le := expsols(rec.eq, k, x)
int:List(F) := [xpart(multivariate(h, k), x) for h in rec.op]
- concat_!([xpart(multivariate(h, k), x) for h in sols],
+ concat!([xpart(multivariate(h, k), x) for h in sols],
[multint(e, int, x) for e in le])
homosolve1(oper, sols, k, x) ==
zero?(n := (degree(oper) - #sols)::N) => sols -- all solutions found
rec := ReduceOrder(oper, sols)
int:List(F) := [xpart(h, x) for h in rec.op]
- concat_!(sols, [multint(e, int, x) for e in norf1(rec.eq, k, x, n::N)])
+ concat!(sols, [multint(e, int, x) for e in norf1(rec.eq, k, x, n::N)])
-- if the coefficients are rational functions, then the equation does not
-- not have a proper 1st-order right factor over the rational functions
@@ -289,7 +289,7 @@ ElementaryFunctionLODESolver(R, F, L): Exports == Implementation where
-- left hand side has rational coefficients
rfSolve(eq, g, k, x) ==
op := ulodo(eq, k)
- empty? remove_!(k, varselect(kernels g, x)) => -- i.e. rhs is rational
+ empty? remove!(k, varselect(kernels g, x)) => -- i.e. rhs is rational
rc := ratDsolve(op, univariate(g, k))
rc.particular case "failed" => -- this implies g ~= 0
doVarParams(eq, g, homosolve(eq, op, rc.basis, k, x), x)
@@ -305,7 +305,7 @@ ElementaryFunctionLODESolver(R, F, L): Exports == Implementation where
for i in minIndex v .. maxIndex v for yy in y0 repeat
v.i := yy - eval(h, kx, a)
h := diff h
- (sol := particularSolution(map_!(eval(#1,kx,a),wronskianMatrix(b,n)), v))
+ (sol := particularSolution(map!(eval(#1,kx,a),wronskianMatrix(b,n)), v))
case "failed" => "failed"
for f in b for i in minIndex(s := sol::V) .. repeat
hp := hp + s.i * f
@@ -510,7 +510,7 @@ ElementaryFunctionODESolver(R, F): Exports == Implementation where
for eq in eqs repeat
(u := parseSYSeq(eq,lk0,lk1,lf,x)) case "failed" => return "failed"
rec := u::ROW
- setRow_!(m, rec.index, rec.row)
+ setRow!(m, rec.index, rec.row)
v(rec.index) := rec.rh
[m, v]
diff --git a/src/algebra/oderf.spad.pamphlet b/src/algebra/oderf.spad.pamphlet
index bc256aef..140c41a8 100644
--- a/src/algebra/oderf.spad.pamphlet
+++ b/src/algebra/oderf.spad.pamphlet
@@ -496,7 +496,7 @@ RationalLODE(F, UP): Exports == Implementation where
sol.particular case "failed" => "failed"
makeDot(sol.particular::V, lb) + first(rec.particular)
[part,
- concat_!(lsol, [makeDot(v, lb) for v in sol.basis | nzero? v])]
+ concat!(lsol, [makeDot(v, lb) for v in sol.basis | nzero? v])]
indicialEquationAtInfinity(op:LODO2) ==
rec := infMuLambda op
@@ -649,14 +649,14 @@ ODETools(F, LODO): Exports == Implementation where
v:V := vector l
m:M := zero(q, #v)
for i in minRowIndex m .. maxRowIndex m repeat
- setRow_!(m, i, v)
- v := map_!(diff #1, v)
+ setRow!(m, i, v)
+ v := map!(diff #1, v)
m
variationOfParameters(op, g, b) ==
empty? b => "failed"
v:V := new(n := degree op, 0)
- qsetelt_!(v, maxIndex v, g / leadingCoefficient op)
+ qsetelt!(v, maxIndex v, g / leadingCoefficient op)
particularSolution(wronskianMatrix(b, n), v)
particularSolution(op, g, b, integration) ==
@@ -811,7 +811,7 @@ ConstantLODE(R, F, L): Exports == Implementation where
op := reductum op
b:List(F) := empty()
for ff in factors ffactor p repeat
- b := concat_!(b, basisSol(ff.factor, dec(ff.exponent), x))
+ b := concat!(b, basisSol(ff.factor, dec(ff.exponent), x))
b
basisSol(p, n, x) ==
@@ -820,7 +820,7 @@ ConstantLODE(R, F, L): Exports == Implementation where
ll := copy l
xn := x::F
for i in 1..n repeat
- l := concat_!(l, [xn * f for f in ll])
+ l := concat!(l, [xn * f for f in ll])
xn := x * xn
l
diff --git a/src/algebra/op.spad.pamphlet b/src/algebra/op.spad.pamphlet
index 09fba256..dc738dbe 100644
--- a/src/algebra/op.spad.pamphlet
+++ b/src/algebra/op.spad.pamphlet
@@ -83,7 +83,7 @@ BasicOperator(): Exports == Implementation where
assert : (%, Identifier) -> $
++ \spad{assert(op, p)} attaches property \spad{p} to \spad{op}.
++ Argument op is modified "in place", i.e. no copy is made.
- deleteProperty_!: ($, String) -> $
+ deleteProperty!: ($, String) -> $
++ deleteProperty!(op, s) unattaches property s from op.
++ Argument op is modified "in place", i.e. no copy is made.
deleteProperty!: ($, Identifier) -> $
@@ -142,7 +142,7 @@ BasicOperator(): Exports == Implementation where
equality(op, func) == setProperty(op, EQUAL?, func pretend None)
comparison(op, func) == setProperty(op, LESS?, func pretend None)
display(op:$, f:O -> O) == display(op, f first #1)
- deleteProperty_!(op: %, name: String) == (remove_!(name, properties op); op)
+ deleteProperty!(op: %, name: String) == (remove!(name, properties op); op)
deleteProperty!(op: %, p: Identifier) ==
remove!(STRING(p)$Foreign(Builtin), properties op)
op
diff --git a/src/algebra/opalg.spad.pamphlet b/src/algebra/opalg.spad.pamphlet
index cad0a61c..6404a137 100644
--- a/src/algebra/opalg.spad.pamphlet
+++ b/src/algebra/opalg.spad.pamphlet
@@ -140,12 +140,12 @@ ModuleOperator(R: Ring, M:LeftModule(R)): Exports == Implementation where
rm := last xx
one?(first(y).coef) =>
rm.monom := rm.monom * first(y).monom
- concat_!(xx, termcopy rest y)
+ concat!(xx, termcopy rest y)
one?(rm.monom) =>
rm.coef := rm.coef * first(y).coef
rm.monom := first(y).monom
- concat_!(xx, termcopy rest y)
- concat_!(xx, termcopy y)
+ concat!(xx, termcopy rest y)
+ concat!(xx, termcopy y)
if M has ExpressionSpace then
opeval(op, r) ==
@@ -168,7 +168,7 @@ ModuleOperator(R: Ring, M:LeftModule(R)): Exports == Implementation where
r
monomeval(m, r) ==
- for rec in reverse_! factors m repeat
+ for rec in reverse! factors m repeat
e := rec.exp
g := rec.gen
e > 0 =>
diff --git a/src/algebra/padic.spad.pamphlet b/src/algebra/padic.spad.pamphlet
index 5fc2275c..49de0bcf 100644
--- a/src/algebra/padic.spad.pamphlet
+++ b/src/algebra/padic.spad.pamphlet
@@ -307,7 +307,7 @@ InnerPAdicInteger(p,unBalanced?): Exports == Implementation where
eq?(st,rst st) and frst st = 0 => l
concat(prefix("O" :: OUT,[PEXPR ** (n :: OUT)]),l)
empty? l => 0 :: OUT
- reduce("+",reverse_! l)
+ reduce("+",reverse! l)
@
\section{domain PADIC PAdicInteger}
@@ -529,7 +529,7 @@ PAdicRationalConstructor(p,PADIC): Exports == Implementation where
eq?(uu,rst uu) and frst uu = 0 => l
concat(prefix("O" :: OUT,[PEXPR ** ((n :: I) + m) :: OUT]),l)
empty? l => 0 :: OUT
- reduce("+",reverse_! l)
+ reduce("+",reverse! l)
@
\section{domain PADICRAT PAdicRational}
diff --git a/src/algebra/padiclib.spad.pamphlet b/src/algebra/padiclib.spad.pamphlet
index 460bdfc6..b32e096d 100644
--- a/src/algebra/padiclib.spad.pamphlet
+++ b/src/algebra/padiclib.spad.pamphlet
@@ -88,7 +88,7 @@ IntegralBasisPolynomialTools(K,R,UP,L): Exports == Implementation where
for i in 1..m repeat for j in 1..n repeat
(poly := mapUnivariateIfCan(f,qelt(mat,i,j))) case "failed" =>
return "failed"
- qsetelt_!(matOut,i,j,poly :: R)
+ qsetelt!(matOut,i,j,poly :: R)
matOut
mapBivariate(f,poly) ==
@@ -157,7 +157,7 @@ ChineseRemainderToolsForIntegralBases(K,R,UP): Exports == Implementation where
m := nrows mat; n := ncols mat
ans : Matrix R := new(m,n,0)
for i in 1..m repeat for j in 1..n repeat
- qsetelt_!(ans,i,j,map(#1 ** q,qelt(mat,i,j)))
+ qsetelt!(ans,i,j,map(#1 ** q,qelt(mat,i,j)))
ans
listConjugateBases(bas,q,n) ==
@@ -169,7 +169,7 @@ ChineseRemainderToolsForIntegralBases(K,R,UP): Exports == Implementation where
bDen := map(#1 ** q,bDen)
newBasis : Result := [b,bDen,bInv]
outList := concat(newBasis,outList)
- reverse_! outList
+ reverse! outList
factorList(a,q,n,k) ==
coef : SUP K := monomial(a,0); xx : SUP K := monomial(1,1)
@@ -177,7 +177,7 @@ ChineseRemainderToolsForIntegralBases(K,R,UP): Exports == Implementation where
for i in 1..(n-1) repeat
coef := coef ** q
outList := concat((xx - coef)**k,outList)
- reverse_! outList
+ reverse! outList
basisInfoToPolys: (Mat,R,R) -> L UP
basisInfoToPolys(mat,lcm,den) ==
@@ -188,7 +188,7 @@ ChineseRemainderToolsForIntegralBases(K,R,UP): Exports == Implementation where
for j in 0..n1 repeat
pp := pp + monomial((lcm quo den) * qelt(mat,i,j+1),j)
outList := concat(pp,outList)
- reverse_! outList
+ reverse! outList
basesToPolyLists: (L Result,R) -> L L UP
basesToPolyLists(basisList,lcm) ==
@@ -270,7 +270,7 @@ ChineseRemainderToolsForIntegralBases(K,R,UP): Exports == Implementation where
for i in 1.. for pList in factorBasisPolyLists repeat
polyList := mapChineseToList(pList,factors,i,denLCM)
basisPolyLists := concat(polyList,basisPolyLists)
- basisPolys := concat reverse_! basisPolyLists
+ basisPolys := concat reverse! basisPolyLists
mat := squareTop rowEchelon(polyListToMatrix(basisPolys,n),denLCM)
matInv := UpTriBddDenomInv(mat,denLCM)
[mat,denLCM,matInv]
@@ -476,7 +476,7 @@ PAdicWildFunctionFieldIntegralBasis(K,R,UP,F): Exports == Implementation where
compLocalBasisOverExt(qq,prime,pp,k)
compLocalBasis(qq,prime)
factorBases := concat(base,factorBases)
- factorBases := reverse_! factorBases
+ factorBases := reverse! factorBases
ib := chineseRemainder(henselFactors,factorBases,rank()$F)$IBACHIN(K,R,UP)
index := diagonalProduct(ib.basisInv)
[ib.basis,ib.basisDen,ib.basisInv,disc quo (index * index)]
diff --git a/src/algebra/patmatch1.spad.pamphlet b/src/algebra/patmatch1.spad.pamphlet
index 087b8c71..dab2f818 100644
--- a/src/algebra/patmatch1.spad.pamphlet
+++ b/src/algebra/patmatch1.spad.pamphlet
@@ -589,7 +589,7 @@ PatternMatchTools(S, R, P): Exports == Implementation where
-- l2 = patterns with a predicate attached to them
l2 := select(hasPredicate? #1 and not constant? #1, lp)
-- l3 = non-generic patterns without predicates
- l3 := sort_!(depth(#1) > depth(#2),
+ l3 := sort!(depth(#1) > depth(#2),
select(not(hasPredicate? #1 or generic? #1 or constant? #1),lp))
-- l4 = generic patterns with predicates
l4 := select(generic? #1 and
@@ -650,7 +650,7 @@ PatternMatchListAggregate(S, R, L): Exports == Implementation where
failed()
multiple?(p0 := first lp) =>
empty? rest lp =>
- if not new? then l := reverse_! l
+ if not new? then l := reverse! l
makeResult(atoms r, addMatchRestricted(p0,l,lists r,empty()))
new? => match(reverse l, reverse lp, r, false)
error "Only one multiple pattern allowed in list"
diff --git a/src/algebra/pattern.spad.pamphlet b/src/algebra/pattern.spad.pamphlet
index a0e4c3a0..679af677 100644
--- a/src/algebra/pattern.spad.pamphlet
+++ b/src/algebra/pattern.spad.pamphlet
@@ -328,7 +328,7 @@ Pattern(R:SetCategory): Exports == Implementation where
q := p.pat
q case ret => empty()
q case exp => variables(q.exp.val)
- q case qot => concat_!(variables(q.qot.num), variables(q.qot.den))
+ q case qot => concat!(variables(q.qot.num), variables(q.qot.den))
q case ker => concat [variables r for r in q.ker.arg]
empty()
diff --git a/src/algebra/perm.spad.pamphlet b/src/algebra/perm.spad.pamphlet
index 5679493f..57845b95 100644
--- a/src/algebra/perm.spad.pamphlet
+++ b/src/algebra/perm.spad.pamphlet
@@ -338,7 +338,7 @@ removes fixed points from its result.
while el2 ~= el repeat
-- be carefull: insert adds one element
-- as side effect to out
- insert_!(el2, out)
+ insert!(el2, out)
el2 := eval(p, el2)
out
diff --git a/src/algebra/permgrps.spad.pamphlet b/src/algebra/permgrps.spad.pamphlet
index e987cc77..6302f5aa 100644
--- a/src/algebra/permgrps.spad.pamphlet
+++ b/src/algebra/permgrps.spad.pamphlet
@@ -567,7 +567,7 @@ PermutationGroup(S:SetCategory): public == private where
group2 := brace()$(FSET PERM S)
gp : L PERM S := group.gens
for gen in gp repeat
- if degree gen > 0 then insert_!(gen, group2)
+ if degree gen > 0 then insert!(gen, group2)
group2
knownGroup? (gp : %) : Void ==
@@ -705,14 +705,14 @@ PermutationGroup(S:SetCategory): public == private where
outList := orbitInternal ( gp , elList )
outSet := brace()$(FSET S)
for i in 1..#outList repeat
- insert_! ( outList.i.1 , outSet )
+ insert! ( outList.i.1 , outSet )
outSet
orbits ( gp ) ==
spp := movedPoints gp
orbits := nil()$(L FSET S)
while cardinality spp > 0 repeat
- el := extract_! spp
+ el := extract! spp
orbitSet := orbit ( gp , el )
orbits := cons ( orbitSet , orbits )
spp := difference ( spp , orbitSet )
@@ -760,7 +760,7 @@ PermutationGroup(S:SetCategory): public == private where
outSet := brace()$(FSET FSET S)
for i in 1..#outList repeat
newSet : FSET S := brace outList.i
- insert_! ( newSet , outSet )
+ insert! ( newSet , outSet )
outSet
orbit ( gp : % , startList : L S ) : FSET L S ==
diff --git a/src/algebra/pf.spad.pamphlet b/src/algebra/pf.spad.pamphlet
index 38c956bb..ee7dbd24 100644
--- a/src/algebra/pf.spad.pamphlet
+++ b/src/algebra/pf.spad.pamphlet
@@ -152,9 +152,9 @@ InnerPrimeField(p:PositiveInteger): Exports == Implementation where
tbl:TBL:=table()$TBL
a:$:=1
for i in (0::NNI)..(n-1)::NNI repeat
- insert_!([lookup(a),i::NNI]$R,tbl)$TBL
+ insert!([lookup(a),i::NNI]$R,tbl)$TBL
a:=a*base
- insert_!([fac::PI,copy(tbl)$TBL]_
+ insert!([fac::PI,copy(tbl)$TBL]_
$Record(key:PI,entry:TBL),discLogTable)$Table(PI,TBL)
-- tell user about initialization
-- print("discrete logarithm table initialized"::OUT)
diff --git a/src/algebra/pfbr.spad.pamphlet b/src/algebra/pfbr.spad.pamphlet
index fd3b9900..b8637020 100644
--- a/src/algebra/pfbr.spad.pamphlet
+++ b/src/algebra/pfbr.spad.pamphlet
@@ -466,7 +466,7 @@ PolynomialFactorizationByRecursion(R,E, VarSet:OrderedSet, S): public ==
-- pp1 is mathematically equal to pp, but is in S[z][v]
-- so we wish to operate on all of its coefficients
ans:List SupSupS:= [0 for u in lpolys]
- for m in reverse_! monomials pp1 repeat
+ for m in reverse! monomials pp1 repeat
ans1:=SLPEBR(lpolys,lvpolys,leadingCoefficient m,lvpp)
ans1 case "failed" => return "failed"
d:=degree m
@@ -487,15 +487,15 @@ PolynomialFactorizationByRecursion(R,E, VarSet:OrderedSet, S): public ==
solveLinearPolynomialEquationByFractions(lpolys,pp)$LPEBFS
solveLinearPolynomialEquationByRecursion(lpolys,pp) ==
- lvpolys := removeDuplicates_!
+ lvpolys := removeDuplicates!
concat [ concat [variables z for z in coefficients u]
for u in lpolys]
- lvpp := removeDuplicates_!
+ lvpp := removeDuplicates!
concat [variables z for z in coefficients pp]
SLPEBR(lpolys,lvpolys,pp,lvpp)
factorByRecursion pp ==
- lv:List(VarSet) := removeDuplicates_!
+ lv:List(VarSet) := removeDuplicates!
concat [variables z for z in coefficients pp]
empty? lv =>
map(raise,factorPolynomial lower pp)
@@ -505,7 +505,7 @@ PolynomialFactorizationByRecursion(R,E, VarSet:OrderedSet, S): public ==
mergeFactors(refine(squareFree pp,factorSquareFreeByRecursion),
map(#1:S::SupS,factor(c)$S))
factorSquareFreeByRecursion pp ==
- lv:List(VarSet) := removeDuplicates_!
+ lv:List(VarSet) := removeDuplicates!
concat [variables z for z in coefficients pp]
empty? lv =>
map(raise,factorPolynomial lower pp)
diff --git a/src/algebra/pfo.spad.pamphlet b/src/algebra/pfo.spad.pamphlet
index 118e5d5d..bff9d13d 100644
--- a/src/algebra/pfo.spad.pamphlet
+++ b/src/algebra/pfo.spad.pamphlet
@@ -257,7 +257,7 @@ FunctionSpaceReduce(R, F): Exports == Implementation where
redmap := table()$AssociationList(K, Z)
newReduc() ==
- for k in keys redmap repeat remove_!(k, redmap)
+ for k in keys redmap repeat remove!(k, redmap)
void
bringDown(f, k) ==
@@ -413,7 +413,7 @@ PointsOfFiniteOrder(R0, F, UP, UPUP, R): Exports == Implementation where
alglist d ==
n := numer(i := ideal d)
- select_!(has?(operator #1, ALGOP),
+ select!(has?(operator #1, ALGOP),
setUnion(klist denom i,
"setUnion"/[aklist qelt(n,i) for i in minIndex n..maxIndex n]))
diff --git a/src/algebra/pleqn.spad.pamphlet b/src/algebra/pleqn.spad.pamphlet
index fa296d65..96e29d30 100644
--- a/src/algebra/pleqn.spad.pamphlet
+++ b/src/algebra/pleqn.spad.pamphlet
@@ -412,10 +412,10 @@ ParametricLinearEquations(R,Var,Expon,GR):
for y in pc repeat
rec3:Rec3:= regime (y, coeff, w, psbf, rk, rkmax, mode)
inconsistent? rec3.wcond => "incompatible system"
- if filemode then write_!(rksoln, rec3)
+ if filemode then write!(rksoln, rec3)
else lrec3:= cons(rec3, lrec3)
count:=count+1
- if filemode then close_! rksoln
+ if filemode then close! rksoln
[lrec3, count]$Ranksolns
factorset y ==
@@ -566,9 +566,9 @@ ParametricLinearEquations(R,Var,Expon,GR):
count:I:=0 -- number of distinct regimes
-- rec3: Rec3
for rec3 in lrec3 repeat
- write_!(rksoln, rec3)
+ write!(rksoln, rec3)
count:=count+1
- close_!(rksoln)
+ close!(rksoln)
count
dmp2rfi (p:GR):GF ==
@@ -579,11 +579,11 @@ ParametricLinearEquations(R,Var,Expon,GR):
infilename:=filename$FNAME ("",inname, "regime")
infile: File Rec3:=open$(File Rec3) (infilename, "input")
rksoln:L Rec3:=[]
- rec3:Union(Rec3, "failed"):=readIfCan_!$(File Rec3) (infile)
+ rec3:Union(Rec3, "failed"):=readIfCan!$(File Rec3) (infile)
while rec3 case Rec3 repeat
rksoln:=cons(rec3::Rec3,rksoln) -- replace : to :: for AIX
- rec3:=readIfCan_!$(File Rec3) (infile)
- close_!(infile)
+ rec3:=readIfCan!$(File Rec3) (infile)
+ close!(infile)
rksoln
maxrank rcl ==
diff --git a/src/algebra/plot.spad.pamphlet b/src/algebra/plot.spad.pamphlet
index 0ab68ee1..146c4726 100644
--- a/src/algebra/plot.spad.pamphlet
+++ b/src/algebra/plot.spad.pamphlet
@@ -258,7 +258,7 @@ Plot(): Exports == Implementation where
c := concat(h,c)
q := concat(f h,q)
NUMFUNEVALS := NUMFUNEVALS + 1
- t := c := reverse_! c; p := q := reverse_! q
+ t := c := reverse! c; p := q := reverse! q
s := (h-l)/(minPoints()::F-1)
if (first t) ~= l then
t := c := concat(l,c)
@@ -309,8 +309,8 @@ Plot(): Exports == Implementation where
todot : L L F := nil()
todop : L L P := nil()
while not null rest rest st repeat
- todot := concat_!(todot, st)
- todop := concat_!(todop, sp)
+ todot := concat!(todot, st)
+ todop := concat!(todop, sp)
st := rest st; sp := rest sp
st := headert; sp := headerp
todo1 := todot; todo2 := todop
@@ -346,11 +346,11 @@ Plot(): Exports == Implementation where
tj := tm
t.rest := concat(tj,rest t)
p.rest := concat(f tj, rest p)
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
todo1 := rest todo1; todo2 := rest todo2
@@ -358,11 +358,11 @@ Plot(): Exports == Implementation where
tj := tm
t.rest := concat(tj, rest t)
p.rest := concat(f tj, rest p)
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
todo1 := rest todo1
todo2 := rest todo2
if not null todo1 then (t := first(todo1); p := first(todo2))
@@ -371,19 +371,19 @@ Plot(): Exports == Implementation where
tj := tm
t.rest := concat(tj,rest t)
p.rest := concat(f tj, rest p)
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
tm := (t1+t2)/2::F
tj := tm
t.rest := concat(tj, rest t)
p.rest := concat(f tj, rest p)
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
todo1 := rest todo1
todo2 := rest todo2
if not null todo1 then (t := first(todo1); p := first(todo2))
@@ -406,8 +406,8 @@ Plot(): Exports == Implementation where
l := l+s
t := concat(l,t)
p := concat(f l,p)
- t := reverse_! concat(h,t)
- p := reverse_! concat(f h,p)
+ t := reverse! concat(h,t)
+ p := reverse! concat(f h,p)
-- print(p::OutputForm)
xRange : R := select(p,xCoord,min) .. select(p,xCoord,max)
yRange : R := select(p,yCoord,min) .. select(p,yCoord,max)
@@ -561,11 +561,11 @@ Plot(): Exports == Implementation where
yRange := third(curve.ranges) :: OUT
l : L OUT := [xSymbol,xRange,spaces,ySymbol,yRange]
if parametric? r then
- l := concat_!([tSymbol,tRange,spaces],l)
+ l := concat!([tSymbol,tRange,spaces],l)
h : OUT := hconcat l
l := [p::OUT for p in curve.points]
f := concat(vconcat concat(h,l),f)
- prefix("PLOT" :: OUT, reverse_! f)
+ prefix("PLOT" :: OUT, reverse! f)
@
diff --git a/src/algebra/plot3d.spad.pamphlet b/src/algebra/plot3d.spad.pamphlet
index 658b3a32..acabe73b 100644
--- a/src/algebra/plot3d.spad.pamphlet
+++ b/src/algebra/plot3d.spad.pamphlet
@@ -216,7 +216,7 @@ Plot3D(): Exports == Implementation where
if first c < h then
c := concat(h,c); q := concat(f h,q)
NUMFUNEVALS := NUMFUNEVALS + 1
- t := c := reverse_! c; p := q := reverse_! q
+ t := c := reverse! c; p := q := reverse! q
s := (h-l)/(MINPOINTS::F-1)
if (first t) ~= l then
t := c := concat(l,c); p := q := concat(f l,p)
@@ -264,8 +264,8 @@ Plot3D(): Exports == Implementation where
todot : L L F := nil()
todop : L L P := nil()
while not null rest rest st repeat
- todot := concat_!(todot, st)
- todop := concat_!(todop, sp)
+ todot := concat!(todot, st)
+ todop := concat!(todop, sp)
st := rest st; sp := rest sp
st := headert; sp := headerp
todo1 := todot; todo2 := todop
@@ -304,11 +304,11 @@ Plot3D(): Exports == Implementation where
tj := tm
t.rest := concat(tj,rest t)
p.rest := concat(f tj, rest p)
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
todo1 := rest todo1; todo2 := rest todo2
@@ -316,11 +316,11 @@ Plot3D(): Exports == Implementation where
tj := tm
t.rest := concat(tj, rest t)
p.rest := concat(f tj, rest p)
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
todo1 := rest todo1; todo2 := rest todo2
if not null todo1 then (t := first(todo1); p := first(todo2))
else
@@ -328,19 +328,19 @@ Plot3D(): Exports == Implementation where
tj := tm
t.rest := concat(tj,rest t)
p.rest := concat(f tj, rest p)
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
t := rest t; p := rest p
tm := (t1+t2)/2::F
tj := tm
t.rest := concat(tj, rest t)
p.rest := concat(f tj, rest p)
- todo1 := concat_!(todo1, t)
- todo2 := concat_!(todo2, p)
+ todo1 := concat!(todo1, t)
+ todo2 := concat!(todo2, p)
todo1 := rest todo1; todo2 := rest todo2
if not null todo1 then (t := first(todo1); p := first(todo2))
if n > 0 then
@@ -359,8 +359,8 @@ Plot3D(): Exports == Implementation where
for i in 2..MINPOINTS-1 repeat
l := l+s; t := concat(l,t)
p := concat(f l,p)
- t := reverse_! concat(h,t)
- p := reverse_! concat(f h,p)
+ t := reverse! concat(h,t)
+ p := reverse! concat(f h,p)
xRange : R := select(p,xCoord,min) .. select(p,xCoord,max)
yRange : R := select(p,yCoord,min) .. select(p,yCoord,max)
zRange : R := select(p,zCoord,min) .. select(p,zCoord,max)
@@ -481,11 +481,11 @@ Plot3D(): Exports == Implementation where
zRange := coerce curve.ranges.3
l : L OUT := [xSymbol,xRange,spaces,ySymbol,yRange,_
spaces,zSymbol,zRange]
- l := concat_!([tSymbol,tRange,spaces],l)
+ l := concat!([tSymbol,tRange,spaces],l)
h : OUT := hconcat l
l := [p::OUT for p in curve.points]
f := concat(vconcat concat(h,l),f)
- prefix("PLOT" :: OUT,reverse_! f)
+ prefix("PLOT" :: OUT,reverse! f)
----% graphics output
diff --git a/src/algebra/poly.spad.pamphlet b/src/algebra/poly.spad.pamphlet
index c71af1d9..19ec9808 100644
--- a/src/algebra/poly.spad.pamphlet
+++ b/src/algebra/poly.spad.pamphlet
@@ -653,7 +653,7 @@ SparseUnivariatePolynomial(R:Ring): UnivariatePolynomialCategory(R) with
(u:=subtractIfCan(p1.first.k, n)) case "failed" => leave
rout:=[[u, p1.first.c], :rout]
p1:=fmecg(p1.rest, rout.first.k, rout.first.c, p2)
- [reverse_!(rout),p1]
+ [reverse!(rout),p1]
if R has IntegralDomain then
discriminant(p) == discriminant(p)$PseudoRemainderSequence(R,%)
@@ -722,7 +722,7 @@ SparseUnivariatePolynomial(R:Ring): UnivariatePolynomialCategory(R) with
(u:=subtractIfCan(p1.first.k, n)) case "failed" => leave
rout:=[[u, ct * p1.first.c], :rout]
p1:=fmecg(p1.rest, rout.first.k, rout.first.c, p2)
- [reverse_!(rout),p1]
+ [reverse!(rout),p1]
p / co == inv(co) * p
diff --git a/src/algebra/polycat.spad.pamphlet b/src/algebra/polycat.spad.pamphlet
index e4a5dce3..46cd1e87 100644
--- a/src/algebra/polycat.spad.pamphlet
+++ b/src/algebra/polycat.spad.pamphlet
@@ -432,17 +432,17 @@ PolynomialCategory(R:Ring, E:OrderedAbelianMonoidSup, VarSet:OrderedSet):
if R has IntegralDomain then
allMonoms(l:List %):List(%) ==
- removeDuplicates_! concat [primitiveMonomials p for p in l]
+ removeDuplicates! concat [primitiveMonomials p for p in l]
P2R(p:%, b:List E, n:NonNegativeInteger):Vector(R) ==
w := new(n, 0)$Vector(R)
for i in minIndex w .. maxIndex w for bj in b repeat
- qsetelt_!(w, i, coefficient(p, bj))
+ qsetelt!(w, i, coefficient(p, bj))
w
eq2R(l:List %, b:List E):Matrix(R) ==
matrix [[coefficient(p, bj) for p in l] for bj in b]
reducedSystem(m:Matrix %):Matrix(R) ==
l := listOfLists m
- b := removeDuplicates_!
+ b := removeDuplicates!
concat [allMonoms r for r in l]$List(List(%))
d := [degree bj for bj in b]
mm := eq2R(first l, d)
@@ -455,7 +455,7 @@ PolynomialCategory(R:Ring, E:OrderedAbelianMonoidSup, VarSet:OrderedSet):
Record(mat:Matrix R, vec:Vector R) ==
l := listOfLists m
r := entries v
- b : List % := removeDuplicates_! concat(allMonoms r,
+ b : List % := removeDuplicates! concat(allMonoms r,
concat [allMonoms s for s in l]$List(List(%)))
d := [degree bj for bj in b]
n := #d
@@ -832,7 +832,7 @@ UnivariatePolynomialCategory(R:Ring): Category ==
vectorise(p, n) ==
m := minIndex(v := new(n, 0)$Vector(R))
for i in minIndex v .. maxIndex v repeat
- qsetelt_!(v, i, coefficient(p, (i - m)::NonNegativeInteger))
+ qsetelt!(v, i, coefficient(p, (i - m)::NonNegativeInteger))
v
retract(p:%):R ==
zero? p => 0
diff --git a/src/algebra/primelt.spad.pamphlet b/src/algebra/primelt.spad.pamphlet
index 1e392bdd..725c6750 100644
--- a/src/algebra/primelt.spad.pamphlet
+++ b/src/algebra/primelt.spad.pamphlet
@@ -97,7 +97,7 @@ PrimitiveElement(F): Exports == Implementation where
case "failed" => error "Should not happen"
ll := concat(map(#1,
(- univariate(coefficient(p,0)) * bc.coef1) rem pw), ll)
- concat(map(#1, pw), reverse_! ll)
+ concat(map(#1, pw), reverse! ll)
primitiveElement(l, vars, uu) ==
u := uu::P
diff --git a/src/algebra/pscat.spad.pamphlet b/src/algebra/pscat.spad.pamphlet
index 0930aa2b..fbc1806f 100644
--- a/src/algebra/pscat.spad.pamphlet
+++ b/src/algebra/pscat.spad.pamphlet
@@ -313,7 +313,7 @@ UnivariateTaylorSeriesCategory(Coef): Category == Definition where
eq?(uu,rst uu) and frst uu = 0 => l
concat(prefix("O" :: OUT,[vv ** (n :: OUT)]),l)
empty? l => (0$Coef) :: OUT
- reduce("+",reverse_! l)
+ reduce("+",reverse! l)
if Coef has Field then
(x:%) ** (r:Coef) == series power(r,coefficients x)$STTA
diff --git a/src/algebra/puiseux.spad.pamphlet b/src/algebra/puiseux.spad.pamphlet
index ca2a82d7..5ae09734 100644
--- a/src/algebra/puiseux.spad.pamphlet
+++ b/src/algebra/puiseux.spad.pamphlet
@@ -551,7 +551,7 @@ UnivariatePuiseuxSeries(Coef,var,cen): Exports == Implementation where
eq?(uu,rst uu) and frst uu = 0 => l
concat(prefix("O" :: OUT,[xxx ** (((n::I) * rat + m) :: OUT)]),l)
empty? l => 0 :: OUT
- reduce("+",reverse_! l)
+ reduce("+",reverse! l)
coerce(upxs:%):OUT ==
rat := getExpon upxs; uls := laurentRep upxs
diff --git a/src/algebra/radix.spad.pamphlet b/src/algebra/radix.spad.pamphlet
index f67f6a68..c3aa63af 100644
--- a/src/algebra/radix.spad.pamphlet
+++ b/src/algebra/radix.spad.pamphlet
@@ -227,7 +227,7 @@ RadixExpansion(bb): Exports == Implementation where
qr2i := divide(bas * qrt.remainder,den)
rits := concat(qr2i, concat(qrt, rits))
i := i + 1
- rits := reverse_! rits
+ rits := reverse! rits
n := i
-- 2. Find p = first i such that rits.i = rits.(i+n)
ritsi := rits
@@ -258,7 +258,7 @@ RadixExpansion(bb): Exports == Implementation where
for i in 1..c repeat
ritscyc := concat(first(rits).quotient, ritscyc)
rits := rest rits
- [reverse_! ritspfx, reverse_! ritscyc]
+ [reverse! ritspfx, reverse! ritscyc]
@
\section{domain BINARY BinaryExpansion}
diff --git a/src/algebra/realzero.spad.pamphlet b/src/algebra/realzero.spad.pamphlet
index e6c16ca1..695d695a 100644
--- a/src/algebra/realzero.spad.pamphlet
+++ b/src/algebra/realzero.spad.pamphlet
@@ -207,7 +207,7 @@ RealZeroPackage(Pol): T == C where
v := vectorise(F, n+1)
for i in 0..(n-1) repeat
for j in (n-i)..n repeat
- qsetelt_!(v,j, qelt(v,j) + qelt(v,(j+1)))
+ qsetelt!(v,j, qelt(v,j) + qelt(v,(j+1)))
ans : Pol := 0
for i in 0..n repeat
ans := ans + monomial(qelt(v,(i+1)),i)
diff --git a/src/algebra/rep2.spad.pamphlet b/src/algebra/rep2.spad.pamphlet
index b1bc74ad..0cf58d85 100644
--- a/src/algebra/rep2.spad.pamphlet
+++ b/src/algebra/rep2.spad.pamphlet
@@ -293,7 +293,7 @@ RepresentationPackage2(R): public == private where
completedBasis : M R := zero(n, n)
for i in 1..dimensionOfSubmodule repeat
- completedBasis := setRow_!(completedBasis, i, basis.i)
+ completedBasis := setRow!(completedBasis, i, basis.i)
if #basis <= n then
newStart : NNI := 1
for j in 1..n
diff --git a/src/algebra/rf.spad.pamphlet b/src/algebra/rf.spad.pamphlet
index 7daac419..d9cd4e1a 100644
--- a/src/algebra/rf.spad.pamphlet
+++ b/src/algebra/rf.spad.pamphlet
@@ -120,7 +120,7 @@ PolynomialCategoryQuotientFunctions(E, V, R, P, F):
one? num => "failed"
d := inv(den::F)
l case "failed" => [num::F, d]
- concat_!(l::List(F), d)
+ concat!(l::List(F), d)
isPlus f ==
denom f ~= 1 => "failed"
diff --git a/src/algebra/riccati.spad.pamphlet b/src/algebra/riccati.spad.pamphlet
index 43a3c5f1..0fdbe47c 100644
--- a/src/algebra/riccati.spad.pamphlet
+++ b/src/algebra/riccati.spad.pamphlet
@@ -113,7 +113,7 @@ PrimitiveRatRicDE(F, UP, L, LQ): Exports == Implementation where
dmax(rec, c, l) == innermax(rec, l, - order(#1, c)::Z)
tau0(p, q) == ((q exquo (p ** order(q, p)))::UP) rem p
poly1(c, cp, i) == */[monomial(1,1)$UP2 - (j * cp)::UP2 for j in 0..i-1]
- getIndices(n, l) == removeDuplicates_! concat [r.ij for r in l | r.deg=n]
+ getIndices(n, l) == removeDuplicates! concat [r.ij for r in l | r.deg=n]
denomRicDE l == */[c ** bound(c, l) for c in factoredDenomRicDE l]
polyRicDE(l, zeros) == concat([0, l], polysol(l, 0, false, zeros))
@@ -126,7 +126,7 @@ PrimitiveRatRicDE(F, UP, L, LQ): Exports == Implementation where
ans:List(FRC) := empty()
finite? and zero? b => ans
lc := leadingDenomRicDE(c, op)
- if finite? then lc := select_!(#1.deg <= b, lc)
+ if finite? then lc := select!(#1.deg <= b, lc)
for rec in lc repeat
for r in zeros(c, rec.eq) | r ~= 0 repeat
rcn := r /$RF (c ** rec.deg)
@@ -134,7 +134,7 @@ PrimitiveRatRicDE(F, UP, L, LQ): Exports == Implementation where
sols := padicsol(c, neweq, (rec.deg-1)::N, true, zeros)
ans :=
empty? sols => concat([rcn, neweq], ans)
- concat_!([[rcn + sol.frac, sol.eq] for sol in sols], ans)
+ concat!([[rcn + sol.frac, sol.eq] for sol in sols], ans)
ans
leadingDenomRicDE(c, l) ==
@@ -146,7 +146,7 @@ PrimitiveRatRicDE(F, UP, L, LQ): Exports == Implementation where
not(empty?(ind := dmax(rec, c, l))) repeat
ans := concat([rec.deg, getPol(rec, c, l, ind)], ans)
done := concat(rec.deg, done)
- sort_!(#1.deg > #2.deg, ans)
+ sort!(#1.deg > #2.deg, ans)
getPol(rec, c, l, ind) ==
one?(rec.deg) => getPol1(ind, c, l)
@@ -192,7 +192,7 @@ PrimitiveRatRicDE(F, UP, L, LQ): Exports == Implementation where
not(empty?(ind := infmax(rec, l))) repeat
ans := concat([rec.deg, getPoly(rec, l, ind)], ans)
done := concat(rec.deg, done)
- sort_!(#1.deg > #2.deg, ans)
+ sort!(#1.deg > #2.deg, ans)
factoredDenomRicDE l ==
bd := factors balancedFactorisation(leadingCoefficient l, coefficients l)
@@ -246,7 +246,7 @@ PrimitiveRatRicDE(F, UP, L, LQ): Exports == Implementation where
sols := fracsol(neweq, zeros, rest lc)
ans :=
empty? sols => concat(rec, ans)
- concat_!([[rec.frac + sol.frac, sol.eq] for sol in sols], ans)
+ concat!([[rec.frac + sol.frac, sol.eq] for sol in sols], ans)
ans
-- returns [] if the solutions of l have no polynomial component
@@ -254,7 +254,7 @@ PrimitiveRatRicDE(F, UP, L, LQ): Exports == Implementation where
ans:List(POL) := empty()
finite? and zero? b => ans
lc := leadingCoefficientRicDE l
- if finite? then lc := select_!(#1.deg <= b, lc)
+ if finite? then lc := select!(#1.deg <= b, lc)
for rec in lc repeat
for a in zeros(rec.eq) | a ~= 0 repeat
atn:UP := monomial(a, rec.deg)
@@ -262,7 +262,7 @@ PrimitiveRatRicDE(F, UP, L, LQ): Exports == Implementation where
sols := polysol(neweq, (rec.deg - 1)::N, true, zeros)
ans :=
empty? sols => concat([atn, neweq], ans)
- concat_!([[atn + sol.poly, sol.eq] for sol in sols], ans)
+ concat!([[atn + sol.poly, sol.eq] for sol in sols], ans)
ans
@
@@ -404,7 +404,7 @@ RationalRicDE(F, UP): Exports == Implementation where
for i in 0..n repeat
ans := ans + monomial((sy := new s)::P, i::N)
l := concat(sy, l)
- [ans, reverse_! l]
+ [ans, reverse! l]
ratsln l ==
ls:List(SY) := empty()
@@ -489,7 +489,7 @@ RationalRicDE(F, UP): Exports == Implementation where
n := degree l
ans:List(QF) := empty()
for rec in singRicDE(l, ezfactor) repeat
- ans := removeDuplicates_! concat_!(ans,
+ ans := removeDuplicates! concat!(ans,
[rec.frac + f for f in nonSingSolve(n, rec.eq, zeros)])
#ans = n => return ans
ans
@@ -499,7 +499,7 @@ RationalRicDE(F, UP): Exports == Implementation where
nonSingSolve(n, l, zeros) ==
ans:List(QF) := empty()
for rec in polyRicDE(l, zeros) repeat
- ans := removeDuplicates_! concat_!(ans, nopoly(n,rec.poly,rec.eq,zeros))
+ ans := removeDuplicates! concat!(ans, nopoly(n,rec.poly,rec.eq,zeros))
#ans = n => return ans
ans
@@ -512,7 +512,7 @@ RationalRicDE(F, UP): Exports == Implementation where
nopoly(n, p, l, zeros) ==
ans:List(QF) := empty()
for rec in constantCoefficientRicDE(l, constantRic(#1, zeros)) repeat
- ans := removeDuplicates_! concat_!(ans,
+ ans := removeDuplicates! concat!(ans,
[(rec.constant::UP + p)::QF + f for f in logDerOnly(rec.eq)])
#ans = n => return ans
ans
diff --git a/src/algebra/rule.spad.pamphlet b/src/algebra/rule.spad.pamphlet
index 74771fd6..d98a4ec4 100644
--- a/src/algebra/rule.spad.pamphlet
+++ b/src/algebra/rule.spad.pamphlet
@@ -91,7 +91,7 @@ RewriteRule(Base, R, F): Exports == Implementation where
-- remove the extra properties from the constant symbols in f
F2Symbol f ==
- l := select_!(symbolIfCan #1 case Symbol, tower f)$List(Kernel F)
+ l := select!(symbolIfCan #1 case Symbol, tower f)$List(Kernel F)
eval(f, l, [symbolIfCan(k)::Symbol::F for k in l])
retractIfCan r ==
diff --git a/src/algebra/seg.spad.pamphlet b/src/algebra/seg.spad.pamphlet
index 911cedb0..6f292840 100644
--- a/src/algebra/seg.spad.pamphlet
+++ b/src/algebra/seg.spad.pamphlet
@@ -161,7 +161,7 @@ Segment(S:Type): SegmentCategory(S) with
while l >= h repeat
lr := concat(l, lr)
l := l + inc
- reverse_! lr
+ reverse! lr
expand(s : %) == expand([s]$List(%))$%
map(f : S->S, s : %): List S ==
@@ -177,7 +177,7 @@ Segment(S:Type): SegmentCategory(S) with
while l >= h repeat
lr := concat(f l, lr)
l := l + inc
- reverse_! lr
+ reverse! lr
@
@@ -233,7 +233,7 @@ SegmentFunctions2(R:Type, S:Type): public == private where
while l >= h repeat
lr := concat(f(l), lr)
l := l + inc
- reverse_! lr
+ reverse! lr
@
@@ -437,7 +437,7 @@ UniversalSegment(S: Type): SegmentCategory(S) with
s := first ls
ls := rest ls
ns := BY(SEGMENT(lo s, hi s), incr s)$Segment(S)
- lb := concat_!(lb,ns)
+ lb := concat!(lb,ns)
if not null ls then
s := first ls
st: Stream S := generate(#1 + incr(s)::S, lo s)
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
diff --git a/src/algebra/sex.spad.pamphlet b/src/algebra/sex.spad.pamphlet
index 42dfb0c9..0481c504 100644
--- a/src/algebra/sex.spad.pamphlet
+++ b/src/algebra/sex.spad.pamphlet
@@ -110,7 +110,7 @@ SExpressionOf(Str, Sym, Int, Flt, Expr): Decl == Body where
l : List %
l1 := [b1::OutputForm for b1 in (l := destruct b)]
not null? r =>
- paren blankSeparate concat_!(l1, [dotex, r::OutputForm])
+ paren blankSeparate concat!(l1, [dotex, r::OutputForm])
#l = 2 and (first(l1) = QUOTE)@Boolean => quote first rest l1
paren blankSeparate l1
diff --git a/src/algebra/sgcf.spad.pamphlet b/src/algebra/sgcf.spad.pamphlet
index 500b92b4..752ecd02 100644
--- a/src/algebra/sgcf.spad.pamphlet
+++ b/src/algebra/sgcf.spad.pamphlet
@@ -395,7 +395,7 @@ SymmetricGroupCombinatoricFunctions(): public == private where
vrest := vrest + row(coleman,i)
succ := nextPartition(vrest, row(coleman, i), beta(i))
j : I := i
- coleman := setRow_!(coleman, i, succ)
+ coleman := setRow!(coleman, i, succ)
--for k in 1..ncol repeat
-- vrest(k) := vrest(k) - coleman(i,k)
vrest := vrest - row(coleman,i)
@@ -407,11 +407,11 @@ SymmetricGroupCombinatoricFunctions(): public == private where
j : I := 0
for i in (j+1)::NNI..nrow-1 repeat
succ := nextPartition(vrest,vnull,beta(i))
- coleman := setRow_!(coleman, i, succ)
+ coleman := setRow!(coleman, i, succ)
vrest := vrest - succ
--for k in 1..ncol repeat
-- vrest(k) := vrest(k) - succ(k)
- setRow_!(coleman, nrow, vrest)
+ setRow!(coleman, nrow, vrest)
nextPartition(gamma:V I, part:V I, number:I) ==
diff --git a/src/algebra/solvelin.spad.pamphlet b/src/algebra/solvelin.spad.pamphlet
index f3f6a63e..1bef30f9 100644
--- a/src/algebra/solvelin.spad.pamphlet
+++ b/src/algebra/solvelin.spad.pamphlet
@@ -84,7 +84,7 @@ LinearSystemMatrixPackage(F, Row, Col, M): Cat == Capsule where
v.j := i
for j in 0..nvar-1 repeat
if v.j >= minRowIndex m then
- qsetelt_!(sol, j+minIndex sol, - qelt(m, v.j, maxColIndex m))
+ qsetelt!(sol, j+minIndex sol, - qelt(m, v.j, maxColIndex m))
sol
solve(A:M, b:Col) ==
@@ -227,7 +227,7 @@ LinearSystemPolynomialPackage(R, E, OV, P): Cat == Capsule where
for p in ps for i in 1.. repeat
totalDegree(p,vs) > 1 => error "The system is not linear"
r := poly2vect(p,vs)
- m:=setRow_!(m,i,r.coefvec)
+ m:=setRow!(m,i,r.coefvec)
v.i := - r.reductum
[m, v]
diff --git a/src/algebra/sortpak.spad.pamphlet b/src/algebra/sortpak.spad.pamphlet
index 2d10ddf3..c96e3aa1 100644
--- a/src/algebra/sortpak.spad.pamphlet
+++ b/src/algebra/sortpak.spad.pamphlet
@@ -20,39 +20,39 @@ SortPackage(S,A) : Exports == Implementation where
with (finiteAggregate; shallowlyMutable)
Exports == with
- bubbleSort_!: (A,(S,S) -> Boolean) -> A
+ bubbleSort!: (A,(S,S) -> Boolean) -> A
++ bubbleSort!(a,f) \undocumented
- insertionSort_!: (A, (S,S) -> Boolean) -> A
+ insertionSort!: (A, (S,S) -> Boolean) -> A
++ insertionSort!(a,f) \undocumented
if S has OrderedSet then
- bubbleSort_!: A -> A
+ bubbleSort!: A -> A
++ bubbleSort!(a) \undocumented
- insertionSort_!: A -> A
+ insertionSort!: A -> A
++ insertionSort! \undocumented
Implementation == add
- bubbleSort_!(m,f) ==
+ bubbleSort!(m,f) ==
n := #m
for i in 1..(n-1) repeat
for j in n..(i+1) by -1 repeat
- if f(m.j,m.(j-1)) then swap_!(m,j,j-1)
+ if f(m.j,m.(j-1)) then swap!(m,j,j-1)
m
- insertionSort_!(m,f) ==
+ insertionSort!(m,f) ==
for i in 2..#m repeat
j := i
while j > 1 and f(m.j,m.(j-1)) repeat
- swap_!(m,j,j-1)
+ swap!(m,j,j-1)
j := (j - 1) pretend PositiveInteger
m
if S has OrderedSet then
- bubbleSort_!(m) == bubbleSort_!(m,_<$S)
- insertionSort_!(m) == insertionSort_!(m,_<$S)
+ bubbleSort!(m) == bubbleSort!(m,_<$S)
+ insertionSort!(m) == insertionSort!(m,_<$S)
if A has UnaryRecursiveAggregate(S) then
- bubbleSort_!(m,fn) ==
+ bubbleSort!(m,fn) ==
empty? m => m
l := m
while not empty? (r := l.rest) repeat
- r := bubbleSort_!(r,fn)
+ r := bubbleSort!(r,fn)
x := l.first
if fn(r.first,x) then
l.first := r.first
diff --git a/src/algebra/space.spad.pamphlet b/src/algebra/space.spad.pamphlet
index 52c9de91..21428a1f 100644
--- a/src/algebra/space.spad.pamphlet
+++ b/src/algebra/space.spad.pamphlet
@@ -354,11 +354,11 @@ ThreeSpace(R:Ring):Exports == Implementation where
tmplipt : L NNI := []
for point in children curve repeat
tmplipt := cons(extractIndex point,tmplipt)
- tmpllipt := cons(reverse_! tmplipt,tmpllipt)
- llprop := cons(reverse_! tmplprop, llprop)
- lllipt := cons(reverse_! tmpllipt, lllipt)
+ tmpllipt := cons(reverse! tmplipt,tmpllipt)
+ llprop := cons(reverse! tmplprop, llprop)
+ lllipt := cons(reverse! tmpllipt, lllipt)
space.rep3DField := [pointData space.subspaceField,
- reverse_! lllipt,reverse_! llprop,reverse_! lprop]
+ reverse! lllipt,reverse! llprop,reverse! lprop]
space
@@ -524,7 +524,7 @@ ThreeSpace(R:Ring):Exports == Implementation where
-- the sizes for all the curves
whatSizes := brace()$Set(NNI)
for eachCurve in kid repeat
- insert_!(#children eachCurve,whatSizes)
+ insert!(#children eachCurve,whatSizes)
#whatSizes > 1 => error "Mesh defined with curves of different sizes"
first parts whatSizes < 2 =>
error "Mesh defined with single point curves (use curve())"
diff --git a/src/algebra/stream.spad.pamphlet b/src/algebra/stream.spad.pamphlet
index aa23b60c..1c15a504 100644
--- a/src/algebra/stream.spad.pamphlet
+++ b/src/algebra/stream.spad.pamphlet
@@ -201,7 +201,7 @@ LazyStreamAggregate(S:Type): Category == StreamAggregate(S) with
y := x
l : L S := empty()
for i in 0.. repeat
- explicitlyEmpty? y => return reverse_! l
+ explicitlyEmpty? y => return reverse! l
lazy? y => error "infinite stream"
l := concat(frst y,l)
y := rst y
@@ -262,7 +262,7 @@ LazyStreamAggregate(S:Type): Category == StreamAggregate(S) with
y := x
l : L I := empty()
for i in MIN.. repeat
- explicitlyEmpty? y => return reverse_! l
+ explicitlyEmpty? y => return reverse! l
lazy? y => error "indices: infinite stream"
l := concat(i,l)
y := rst y
@@ -370,7 +370,7 @@ LazyStreamAggregate(S:Type): Category == StreamAggregate(S) with
y := x
l : L % := []
for i in 0.. repeat
- explicitlyEmpty? y => return reverse_! l
+ explicitlyEmpty? y => return reverse! l
lazy? y => error "nodes: infinite stream"
l := concat(y,l)
y := rst y
@@ -617,7 +617,7 @@ Stream(S): Exports == Implementation where
++ showAll?() returns true if all computed entries of streams
++ will be displayed.
--!! this should be a function of one argument
- setrest_!: (%,I,%) -> %
+ setrest!: (%,I,%) -> %
++ setrest!(x,n,y) sets rest(x,n) to y. The function will expand
++ cycles if necessary.
generate: (() -> S) -> %
@@ -670,24 +670,24 @@ Stream(S): Exports == Implementation where
--% signatures of local functions
- setfrst_! : (%,S) -> S
- setrst_! : (%,%) -> %
- setToNil_! : % -> %
- setrestt_! : (%,I,%) -> %
+ setfrst! : (%,S) -> S
+ setrst! : (%,%) -> %
+ setToNil! : % -> %
+ setrestt! : (%,I,%) -> %
lazyEval : % -> %
- expand_! : (%,I) -> %
+ expand! : (%,I) -> %
--% functions to access or change record fields without lazy evaluation
frst x == x.firstElt
rst x == x.restOfStream
- setfrst_!(x,s) == x.firstElt := s
- setrst_!(x,y) == x.restOfStream := y
+ setfrst!(x,s) == x.firstElt := s
+ setrst!(x,y) == x.restOfStream := y
- setToNil_! x ==
+ setToNil! x ==
-- destructively changes x to a null stream
- setfrst_!(x,NullStream); setrst_!(x,NIL$Lisp)
+ setfrst!(x,NullStream); setrst!(x,NIL$Lisp)
x
--% SETCAT functions
@@ -717,7 +717,7 @@ Stream(S): Exports == Implementation where
y := x
for i in 1..count while not empty? y repeat y := rst y
fc := findCycle(count,x)
- not fc.cycle? => bracket reverse_! getm(x,empty(),count)
+ not fc.cycle? => bracket reverse! getm(x,empty(),count)
le : L OUT := empty()
for i in 1..fc.prefix repeat
le := concat(first(x) :: OUT,le)
@@ -728,8 +728,8 @@ Stream(S): Exports == Implementation where
for i in 1..fc.period repeat
pl := concat(frst(x) :: OUT,pl)
x := rest x
- overbar commaSeparate reverse_! pl
- bracket reverse_! concat(pp,le)
+ overbar commaSeparate reverse! pl
+ bracket reverse! concat(pp,le)
listm(x,le,n) ==
explicitlyEmpty? x => le
@@ -747,7 +747,7 @@ Stream(S): Exports == Implementation where
cycElt := cycleElt x
cycElt case "failed" =>
le := listm(x,empty(),_$streamCount$Lisp)
- bracket reverse_! le
+ bracket reverse! le
cycEnt := computeCycleEntry(x,cycElt :: %)
le : L OUT := empty()
while not eq?(x,cycEnt) repeat
@@ -760,8 +760,8 @@ Stream(S): Exports == Implementation where
for i in 1..len repeat
pl := concat(frst(x) :: OUT,pl)
x := rst x
- overbar commaSeparate reverse_! pl
- bracket reverse_! concat(pp,le)
+ overbar commaSeparate reverse! pl
+ bracket reverse! concat(pp,le)
showAll?() ==
NULL(_$streamsShowAll$Lisp)$Lisp => false
@@ -786,10 +786,10 @@ Stream(S): Exports == Implementation where
e := computeCycleEntry(x,ce)
d := distance(x,e)
cycle := complete first(e,len)
- setrst_!(tail cycle,cycle)
+ setrst!(tail cycle,cycle)
d = 0 => cycle
head := complete first(x,d::NNI)
- setrst_!(tail head,cycle)
+ setrst!(tail head,cycle)
head
--% CNAGG functions
@@ -809,12 +809,12 @@ Stream(S): Exports == Implementation where
seteltt:(%,I,S) -> S
seteltt(x,n,s) ==
- n = MIN => setfrst_!(x,s)
+ n = MIN => setfrst!(x,s)
seteltt(rst x,n - 1,s)
setelt(x,n:I,s:S) ==
n < MIN or empty? x => error "setelt: no such element"
- x := expand_!(x,n - MIN + 1)
+ x := expand!(x,n - MIN + 1)
seteltt(x,n,s)
--% IXAGG functions
@@ -852,31 +852,31 @@ Stream(S): Exports == Implementation where
xs := x pretend Stream(S); ys := y pretend Stream(S)
map(g,xs,ys)$StreamFunctions3(S,S,S) pretend %
- fill_!(x,s) ==
- setfrst_!(x,s)
- setrst_!(x,x)
+ fill!(x,s) ==
+ setfrst!(x,s)
+ setrst!(x,x)
- map_!(f,x) ==
- -- too many problems with map_! on a lazy stream, so
+ map!(f,x) ==
+ -- too many problems with map! on a lazy stream, so
-- in this case, an error message is returned
cyclic? x =>
tail := cycleTail x ; y := x
until y = tail repeat
- setfrst_!(y,f frst y)
+ setfrst!(y,f frst y)
y := rst y
x
explicitlyFinite? x =>
y := x
while not empty? y repeat
- setfrst_!(y,f frst y)
+ setfrst!(y,f frst y)
y := rst y
x
error "map!: stream with lazy evaluation"
- swap_!(x,m,n) ==
+ swap!(x,m,n) ==
(not index?(m,x)) or (not index?(n,x)) =>
error "swap!: no such elements"
- x := expand_!(x,max(m,n) - MIN + 1)
+ x := expand!(x,max(m,n) - MIN + 1)
xm := elt(x,m); xn := elt(x,n)
setelt(x,m,xn); setelt(x,n,xm)
x
@@ -903,16 +903,16 @@ Stream(S): Exports == Implementation where
high < low => s
(not index?(low,x)) or (not index?(high,x)) =>
error "setelt: index out of range"
- x := expand_!(x,high - MIN + 1)
+ x := expand!(x,high - MIN + 1)
y := rest(x,(low - MIN) :: NNI)
for i in 0..(high-low) repeat
- setfrst_!(y,s)
+ setfrst!(y,s)
y := rst y
s
not index?(low,x) => error "setelt: index out of range"
x := rest(x,(low - MIN) :: NNI)
- setrst_!(x,x)
- setfrst_!(x,s)
+ setrst!(x,x)
+ setfrst!(x,s)
--% RCAGG functions
@@ -922,8 +922,8 @@ Stream(S): Exports == Implementation where
lazyEvaluate x ==
st := lazyEval x
- setfrst_!(x, frst st)
- setrst_!(x,if EQ(rst st,st)$Lisp then x else rst st)
+ setfrst!(x, frst st)
+ setrst!(x,if EQ(rst st,st)$Lisp then x else rst st)
x
-- empty? is the only function that explicitly causes evaluation
@@ -931,16 +931,16 @@ Stream(S): Exports == Implementation where
empty? x ==
while lazy? x repeat
st := lazyEval x
- setfrst_!(x, frst st)
- setrst_!(x,if EQ(rst st,st)$Lisp then x else rst st)
+ setfrst!(x, frst st)
+ setrst!(x,if EQ(rst st,st)$Lisp then x else rst st)
explicitlyEmpty? x
- --setvalue(x,s) == setfirst_!(x,s)
+ --setvalue(x,s) == setfirst!(x,s)
--setchildren(x,l) ==
--empty? l => error "setchildren: empty list of children"
--not(empty? rest l) => error "setchildren: wrong number of children"
- --setrest_!(x,first l)
+ --setrest!(x,first l)
--% URAGG functions
@@ -952,18 +952,18 @@ Stream(S): Exports == Implementation where
concat(s:S,x:%) == [s,x]
cons(s,x) == concat(s,x)
- cycleSplit_! x ==
+ cycleSplit! x ==
cycElt := cycleElt x
cycElt case "failed" =>
- error "cycleSplit_!: non-cyclic stream"
+ error "cycleSplit!: non-cyclic stream"
y := computeCycleEntry(x,cycElt :: %)
- eq?(x,y) => (setToNil_! x; return y)
+ eq?(x,y) => (setToNil! x; return y)
z := rst x
repeat
- eq?(y,z) => (setrest_!(x,empty()); return y)
+ eq?(y,z) => (setrest!(x,empty()); return y)
x := z ; z := rst z
- expand_!(x,n) ==
+ expand!(x,n) ==
-- expands cycles (if necessary) so that the first n
-- elements of x will not be part of a cycle
n < 1 => x
@@ -980,53 +980,53 @@ Stream(S): Exports == Implementation where
t := cycleTail e
if eq?(t,e) then
t := concat(frst t,empty())
- e := setrst_!(t,t)
- setrst_!(x,e)
+ e := setrst!(t,t)
+ setrst!(x,e)
else
- setrst_!(t,concat(frst e,rst e))
+ setrst!(t,concat(frst e,rst e))
e := rst e
nLessD := (n-d) :: NNI
y := complete first(e,nLessD)
e := rest(e,nLessD)
- setrst_!(tail y,e)
- setrst_!(rest(x,(d-1) :: NNI),y)
+ setrst!(tail y,e)
+ setrst!(rest(x,(d-1) :: NNI),y)
x
first x ==
empty? x => error "Can't take the first of an empty stream."
frst x
- concat_!(x:%,y:%) ==
+ concat!(x:%,y:%) ==
empty? x => y
- setrst_!(tail x,y)
+ setrst!(tail x,y)
- concat_!(x:%,s:S) ==
- concat_!(x,concat(s,empty()))
+ concat!(x:%,s:S) ==
+ concat!(x,concat(s,empty()))
- setfirst_!(x,s) == setelt(x,0,s)
- setelt(x,"first",s) == setfirst_!(x,s)
- setrest_!(x,y) ==
+ setfirst!(x,s) == setelt(x,0,s)
+ setelt(x,"first",s) == setfirst!(x,s)
+ setrest!(x,y) ==
empty? x => error "setrest!: empty stream"
- setrst_!(x,y)
- setelt(x,"rest",y) == setrest_!(x,y)
+ setrst!(x,y)
+ setelt(x,"rest",y) == setrest!(x,y)
- setlast_!(x,s) ==
+ setlast!(x,s) ==
empty? x => error "setlast!: empty stream"
- setfrst_!(tail x, s)
- setelt(x,"last",s) == setlast_!(x,s)
+ setfrst!(tail x, s)
+ setelt(x,"last",s) == setlast!(x,s)
- split_!(x,n) ==
+ split!(x,n) ==
n < MIN => error "split!: index out of range"
n = MIN =>
y : % := empty()
- setfrst_!(y,frst x)
- setrst_!(y,rst x)
- setToNil_! x
+ setfrst!(y,frst x)
+ setrst!(y,rst x)
+ setToNil! x
y
- x := expand_!(x,n - MIN)
+ x := expand!(x,n - MIN)
x := rest(x,(n - MIN - 1) :: NNI)
y := rest x
- setrst_!(x,empty())
+ setrst!(x,empty())
y
--% STREAM functions
@@ -1038,7 +1038,7 @@ Stream(S): Exports == Implementation where
error "Need a non-null list to make a repeating stream."
x0 : % := x := construct l
while not empty? rst x repeat x := rst x
- setrst_!(x,x0)
+ setrst!(x,x0)
if S has SetCategory then
@@ -1086,14 +1086,14 @@ Stream(S): Exports == Implementation where
mathPrint(frst(x)::OUT)$Lisp
output(n-1, rst x)
- setrestt_!(x,n,y) ==
- n = 0 => setrst_!(x,y)
- setrestt_!(rst x,n-1,y)
+ setrestt!(x,n,y) ==
+ n = 0 => setrst!(x,y)
+ setrestt!(rst x,n-1,y)
- setrest_!(x,n,y) ==
+ setrest!(x,n,y) ==
n < 0 or empty? x => error "setrest!: no such rest"
- x := expand_!(x,n+1)
- setrestt_!(x,n,y)
+ x := expand!(x,n+1)
+ setrestt!(x,n,y)
generate f == delay concat(f(), generate f)
gen:(S -> S,S) -> %
diff --git a/src/algebra/string.spad.pamphlet b/src/algebra/string.spad.pamphlet
index 1e08bf30..058da44a 100644
--- a/src/algebra/string.spad.pamphlet
+++ b/src/algebra/string.spad.pamphlet
@@ -208,14 +208,14 @@ CharacterClass: Join(SetCategory, ConvertibleTo String,
empty():% == charClass []
brace():% == charClass []
- insert_!(c, a) == (a(ord c) := true; a)
- remove_!(c: Character, a:%) == (a(ord c) := false; a)
+ insert!(c, a) == (a(ord c) := true; a)
+ remove!(c: Character, a:%) == (a(ord c) := false; a)
inspect(a) ==
for i in 0..N-1 | a.i repeat
return char i
error "Cannot take a character from an empty class."
- extract_!(a) ==
+ extract!(a) ==
for i in 0..N-1 | a.i repeat
a.i := false
return char i
@@ -227,10 +227,10 @@ CharacterClass: Join(SetCategory, ConvertibleTo String,
b
temp: % := new(N, false)$Rep
- map_!(f, a) ==
- fill_!(temp, false)
+ map!(f, a) ==
+ fill!(temp, false)
for i in 0..N-1 | a.i repeat temp(ord f char i) := true
- copyInto_!(a, temp, 0)
+ copyInto!(a, temp, 0)
parts a ==
[char i for i in 0..N-1 | a.i]
@@ -282,8 +282,8 @@ IndexedString(mn:Integer): Export == Implementation where
insert(s:%, t:%, i:I) == concat(concat(s(mn..i-1), t), s(i..))
coerce(s:%):OutputForm == outputForm(s pretend String)
minIndex s == mn
- upperCase_! s == map_!(upperCase, s)
- lowerCase_! s == map_!(lowerCase, s)
+ upperCase! s == map!(upperCase, s)
+ lowerCase! s == map!(lowerCase, s)
latex s == concat("\mbox{``", concat(s pretend String, "''}"))
@@ -347,7 +347,7 @@ IndexedString(mn:Integer): Export == Implementation where
l := concat(s(i..j-1), l)
for i in j..n while s.i = c repeat 0
if i <= n then l := concat(s(i..n), l)
- reverse_! l
+ reverse! l
split(s, cc) ==
n := maxIndex s
@@ -359,7 +359,7 @@ IndexedString(mn:Integer): Export == Implementation where
l := concat(s(i..j-1), l)
for i in j..n while member?(s.i,cc) repeat 0
if i <= n then l := concat(s(i..n), l)
- reverse_! l
+ reverse! l
leftTrim(s, c) ==
n := maxIndex s
@@ -387,11 +387,11 @@ IndexedString(mn:Integer): Export == Implementation where
t := new(+/[#s for s in l], space$C)
i := mn
for s in l repeat
- copyInto_!(t, s, i)
+ copyInto!(t, s, i)
i := i + #s
t
- copyInto_!(y, x, s) ==
+ copyInto!(y, x, s) ==
m := #x
n := #y
s := s - mn
diff --git a/src/algebra/sum.spad.pamphlet b/src/algebra/sum.spad.pamphlet
index 0a4cd212..478a5e94 100644
--- a/src/algebra/sum.spad.pamphlet
+++ b/src/algebra/sum.spad.pamphlet
@@ -196,7 +196,7 @@ GosperSummationMethod(E, V, R, P, Q): Exports == Impl where
dmz := degree mz
mz := reductum mz
dmz = 0 => vec(dz + minIndex vec) := -cmz
- qsetelt_!(mat, dz + minRowIndex mat,
+ qsetelt!(mat, dz + minRowIndex mat,
dmz + minColIndex(mat) - 1, cmz)
(soln := particularSolution(mat, vec)) case "failed" => "failed"
vec := soln::Vector RQ
diff --git a/src/algebra/sups.spad.pamphlet b/src/algebra/sups.spad.pamphlet
index 80d3a02e..a45f6482 100644
--- a/src/algebra/sups.spad.pamphlet
+++ b/src/algebra/sups.spad.pamphlet
@@ -1061,7 +1061,7 @@ InnerSparseUnivariatePowerSeries(Coef): Exports == Implementation where
concat(prefix("O" :: OUT,[vv ** ((((deg :: I) + 1) * r) :: OUT)]),l)
l
empty? l => (0$Coef) :: OUT
- reduce("+",reverse_! l)
+ reduce("+",reverse! l)
@
\section{License}
diff --git a/src/algebra/symbol.spad.pamphlet b/src/algebra/symbol.spad.pamphlet
index 6287037b..3a64cc7b 100644
--- a/src/algebra/symbol.spad.pamphlet
+++ b/src/algebra/symbol.spad.pamphlet
@@ -159,7 +159,7 @@ Symbol(): Exports == Implementation where
ns: List Integer := [#sc.presub, #sc.presup, #sc.sup, #sc.sub]
while #ns >= 2 and zero? first ns repeat ns := rest ns
concat concat(concat(hd, istring(#sc.args)),
- [istring n for n in reverse_! ns])
+ [istring n for n in reverse! ns])
syscripts sc ==
all := sc.presub
@@ -272,7 +272,7 @@ Symbol(): Exports == Implementation where
resetNew() ==
count() := 0
- for k in keys xcount repeat remove_!(k, xcount)
+ for k in keys xcount repeat remove!(k, xcount)
void
scripted? sy ==
diff --git a/src/algebra/table.spad.pamphlet b/src/algebra/table.spad.pamphlet
index 4d073045..f62e6011 100644
--- a/src/algebra/table.spad.pamphlet
+++ b/src/algebra/table.spad.pamphlet
@@ -43,7 +43,7 @@ HashTable(Key, Entry, hashfn): Exports == Implementation where
keys t == HKEYS(t)$Lisp
# t == HCOUNT(t)$Lisp
setelt(t, k, e) == HPUT(t,k,e)$Lisp
- remove_!(k:Key, t:%) ==
+ remove!(k:Key, t:%) ==
r := HGET(t,k,failMsg)$Lisp
not EQ(r,failMsg)$Lisp =>
HREM(t, k)$Lisp
@@ -185,7 +185,7 @@ GeneralSparseTable(Key, Entry, Tbl, dent): TableAggregate(Key, Entry) == Impl
u::Entry
setelt(t:%, k:Key, e:Entry) ==
- e = dent => (remove_!(k, t); e)
+ e = dent => (remove!(k, t); e)
setelt(t, k, e)$Rep
search(k:Key, t:%) ==
diff --git a/src/algebra/transsolve.spad.pamphlet b/src/algebra/transsolve.spad.pamphlet
index 5f0d4d24..84475a3b 100644
--- a/src/algebra/transsolve.spad.pamphlet
+++ b/src/algebra/transsolve.spad.pamphlet
@@ -325,12 +325,12 @@ TransSolvePackage(R) : Exports == Implementation where
if listexpr case "failed" then
[1::RE , expr]
else
- listexpr:=remove_!(lcoeff::RE , listexpr)
+ listexpr:=remove!(lcoeff::RE , listexpr)
cons(lcoeff::RE , listexpr)
buildnexpr(expr:RE, Z:S) : L RE ==
nlist:=splitExpr(expr)
- n2list:=remove_!(nlist.1, nlist)
+ n2list:=remove!(nlist.1, nlist)
anscoeff:RE:=1
ansmant:RE:=0
for i in n2list repeat
diff --git a/src/algebra/tree.spad.pamphlet b/src/algebra/tree.spad.pamphlet
index 5b573f8f..d4f187c0 100644
--- a/src/algebra/tree.spad.pamphlet
+++ b/src/algebra/tree.spad.pamphlet
@@ -64,10 +64,10 @@ Tree(S: SetCategory): T==C where
children t ==
t case empty => error "cannot take the children of an empty tree"
(t.node.args)@List(%)
- setchildren_!(t,lt) ==
+ setchildren!(t,lt) ==
t case empty => error "cannot set children of an empty tree"
(t.node.args:=lt;t pretend %)
- setvalue_!(t,s) ==
+ setvalue!(t,s) ==
t case empty => error "cannot set value of an empty tree"
(t.node.value:=s;s)
count(n: S, t: %) ==
@@ -83,10 +83,10 @@ Tree(S: SetCategory): T==C where
map(fn, t) ==
t case empty => t
tree(fn value t,[map(fn, c) for c in children t])
- map_!(fn, t) ==
+ map!(fn, t) ==
t case empty => t
- setvalue_!(t, fn value t)
- for c in children t repeat map_!(fn, c)
+ setvalue!(t, fn value t)
+ for c in children t repeat map!(fn, c)
tree(s,lt) == [[s,lt]]
tree(s) == [[s,[]]]
tree(ls) ==
@@ -350,11 +350,11 @@ BinaryTreeCategory(S: SetCategory): Category == BinaryRecursiveAggregate(S) with
empty? t => empty()
node(copy left t, value t, copy right t)
if % has shallowlyMutable then
- map_!(f,t) ==
+ map!(f,t) ==
empty? t => t
t.value := f(t.value)
- map_!(f,left t)
- map_!(f,right t)
+ map!(f,left t)
+ map!(f,right t)
t
if % has finiteAggregate then
treeCount : (%, NonNegativeInteger) -> NonNegativeInteger
@@ -400,17 +400,17 @@ BinaryTree(S: SetCategory): Exports == Implementation where
value t==
empty? t => error "binaryTree:no value"
value first t
- setvalue_! (t,nd)==
+ setvalue! (t,nd)==
empty? t => error "binaryTree:no value to set"
- setvalue_!(first(t:Rep),nd)
+ setvalue!(first(t:Rep),nd)
nd
- setleft_!(t1,t2) ==
+ setleft!(t1,t2) ==
empty? t1 => error "binaryTree:no left to set"
- setchildren_!(first(t1:Rep),t2:Rep)
+ setchildren!(first(t1:Rep),t2:Rep)
t1
- setright_!(t1,t2) ==
+ setright!(t1,t2) ==
empty? t1 => error "binaryTree:no right to set"
- setrest_!(t1:List Tree S,t2)
+ setrest!(t1:List Tree S,t2)
@
\section{domain BSTREE BinarySearchTree}
@@ -428,9 +428,9 @@ BinarySearchTree(S: OrderedSet): Exports == Implementation where
finiteAggregate
binarySearchTree: List S -> %
++ binarySearchTree(l) \undocumented
- insert_!: (S,%) -> %
+ insert!: (S,%) -> %
++ insert!(x,b) inserts element x as leaves into binary search tree b.
- insertRoot_!: (S,%) -> %
+ insertRoot!: (S,%) -> %
++ insertRoot!(x,b) inserts element x as a root of binary search tree b.
split: (S,%) -> Record(less: %, greater: %)
++ split(x,b) splits binary tree b into two trees, one with elements greater
@@ -440,14 +440,14 @@ BinarySearchTree(S: OrderedSet): Exports == Implementation where
binarySearchTree(u:List S) ==
null u => empty()
tree := binaryTree(first u)
- for x in rest u repeat insert_!(x,tree)
+ for x in rest u repeat insert!(x,tree)
tree
- insert_!(x,t) ==
+ insert!(x,t) ==
empty? t => binaryTree(x)
x >= value t =>
- setright_!(t,insert_!(x,right t))
+ setright!(t,insert!(x,right t))
t
- setleft_!(t,insert_!(x,left t))
+ setleft!(t,insert!(x,left t))
t
split(x,t) ==
empty? t => [empty(),empty()]
@@ -456,7 +456,7 @@ BinarySearchTree(S: OrderedSet): Exports == Implementation where
[node(left t, value t, a.less), a.greater]
a := split(x,left t)
[a.less, node(a.greater, value t, right t)]
- insertRoot_!(x,t) ==
+ insertRoot!(x,t) ==
a := split(x,t)
node(a.less, x, a.greater)
@@ -475,22 +475,22 @@ BinaryTournament(S: OrderedSet): Exports == Implementation where
binaryTournament: List S -> %
++ binaryTournament(ls) creates a binary tournament with the
++ elements of ls as values at the nodes.
- insert_!: (S,%) -> %
+ insert!: (S,%) -> %
++ insert!(x,b) inserts element x as leaves into binary tournament b.
Implementation == BinaryTree(S) add
Rep := BinaryTree(S)
binaryTournament(u:List S) ==
null u => empty()
tree := binaryTree(first u)
- for x in rest u repeat insert_!(x,tree)
+ for x in rest u repeat insert!(x,tree)
tree
- insert_!(x,t) ==
+ insert!(x,t) ==
empty? t => binaryTree(x)
x > value t =>
- setleft_!(t,copy t)
- setvalue_!(t,x)
- setright_!(t,empty())
- setright_!(t,insert_!(x,right t))
+ setleft!(t,copy t)
+ setvalue!(t,x)
+ setright!(t,empty())
+ setright!(t,insert!(x,right t))
t
@
@@ -515,16 +515,16 @@ BalancedBinaryTree(S: SetCategory): Exports == Implementation where
balancedBinaryTree: (NonNegativeInteger, S) -> %
++ balancedBinaryTree(n, s) creates a balanced binary tree with
++ n nodes each with value s.
- setleaves_!: (%, List S) -> %
+ setleaves!: (%, List S) -> %
++ setleaves!(t, ls) sets the leaves of t in left-to-right order
++ to the elements of ls.
- mapUp_!: (%, (S,S) -> S) -> S
+ mapUp!: (%, (S,S) -> S) -> S
++ mapUp!(t,f) traverses balanced binary tree t in an "endorder"
++ (left then right then node) fashion returning t with the value
++ at each successive interior node of t replaced by
++ f(l,r) where l and r are the values at the immediate
++ left and right nodes.
- mapUp_!: (%, %, (S,S,S,S) -> S) -> %
+ mapUp!: (%, %, (S,S,S,S) -> S) -> %
++ mapUp!(t,t1,f) traverses t in an "endorder" (left then right then node)
++ fashion returning t with the value at each successive interior
++ node of t replaced by
@@ -532,14 +532,14 @@ BalancedBinaryTree(S: SetCategory): Exports == Implementation where
++ left and right nodes. Values l1 and r1 are values at the
++ corresponding nodes of a balanced binary tree t1, of identical
++ shape at t.
- mapDown_!: (%,S,(S,S) -> S) -> %
+ mapDown!: (%,S,(S,S) -> S) -> %
++ mapDown!(t,p,f) returns t after traversing t in "preorder"
++ (node then left then right) fashion replacing the successive
++ interior nodes as follows. The root value x is
++ replaced by q := f(p,x). The mapDown!(l,q,f) and
++ mapDown!(r,q,f) are evaluated for the left and right subtrees
++ l and r of t.
- mapDown_!: (%,S, (S,S,S) -> List S) -> %
+ mapDown!: (%,S, (S,S,S) -> List S) -> %
++ mapDown!(t,p,f) returns t after traversing t in "preorder"
++ (node then left then right) fashion replacing the successive
++ interior nodes as follows. Let l and r denote the left and
@@ -556,22 +556,22 @@ BalancedBinaryTree(S: SetCategory): Exports == Implementation where
-- balancedBinaryTree(x: S, u: List S) ==
-- n := #u
-- n = 0 => empty()
--- setleaves_!(balancedBinaryTree(n, x), u)
- setleaves_!(t, u) ==
+-- setleaves!(balancedBinaryTree(n, x), u)
+ setleaves!(t, u) ==
n := #u
n = 0 =>
empty? t => t
error "the tree and list must have the same number of elements"
n = 1 =>
- setvalue_!(t,first u)
+ setvalue!(t,first u)
t
m := n quo 2
acc := empty()$(List S)
for i in 1..m repeat
acc := [first u,:acc]
u := rest u
- setleaves_!(left t, reverse_! acc)
- setleaves_!(right t, u)
+ setleaves!(left t, reverse! acc)
+ setleaves!(right t, u)
t
balancedBinaryTree(n: NonNegativeInteger, val: S) ==
n = 0 => empty()
@@ -579,33 +579,33 @@ BalancedBinaryTree(S: SetCategory): Exports == Implementation where
m := n quo 2
node(balancedBinaryTree(m, val), val,
balancedBinaryTree((n - m) pretend NonNegativeInteger, val))
- mapUp_!(x,fn) ==
+ mapUp!(x,fn) ==
empty? x => error "mapUp! called on a null tree"
leaf? x => x.value
- x.value := fn(mapUp_!(x.left,fn),mapUp_!(x.right,fn))
- mapUp_!(x,y,fn) ==
+ x.value := fn(mapUp!(x.left,fn),mapUp!(x.right,fn))
+ mapUp!(x,y,fn) ==
empty? x => error "mapUp! is called on a null tree"
leaf? x =>
leaf? y => x
error "balanced binary trees are incompatible"
leaf? y => error "balanced binary trees are incompatible"
- mapUp_!(x.left,y.left,fn)
- mapUp_!(x.right,y.right,fn)
+ mapUp!(x.left,y.left,fn)
+ mapUp!(x.right,y.right,fn)
x.value := fn(x.left.value,x.right.value,y.left.value,y.right.value)
x
- mapDown_!(x: %, p: S, fn: (S,S) -> S ) ==
+ mapDown!(x: %, p: S, fn: (S,S) -> S ) ==
empty? x => x
x.value := fn(p, x.value)
- mapDown_!(x.left, x.value, fn)
- mapDown_!(x.right, x.value, fn)
+ mapDown!(x.left, x.value, fn)
+ mapDown!(x.right, x.value, fn)
x
- mapDown_!(x: %, p: S, fn: (S,S,S) -> List S) ==
+ mapDown!(x: %, p: S, fn: (S,S,S) -> List S) ==
empty? x => x
x.value := p
leaf? x => x
u := fn(x.left.value, x.right.value, p)
- mapDown_!(x.left, u.1, fn)
- mapDown_!(x.right, u.2, fn)
+ mapDown!(x.left, u.1, fn)
+ mapDown!(x.right, u.2, fn)
x
@
diff --git a/src/algebra/tube.spad.pamphlet b/src/algebra/tube.spad.pamphlet
index b2efebff..48cc89cb 100644
--- a/src/algebra/tube.spad.pamphlet
+++ b/src/algebra/tube.spad.pamphlet
@@ -338,7 +338,7 @@ ExpressionTubePlot(): Exports == Implementation where
bNorm : Pt := point bNormList
lps := loopPoints(ctr,pNorm,bNorm,radFcn tval,cosSin)
loopList := cons(lps,loopList)
- tube(parPlot,reverse_! loopList,flag)
+ tube(parPlot,reverse! loopList,flag)
tubePlot(x:FE,y:FE,z:FE,colorFcn:SF -> SF,_
tRange:SEG SF,radFcn:SF -> SF,n:I) ==
@@ -449,7 +449,7 @@ NumericTubePlot(Curve): Exports == Implementation where
for pt in pts for triad in triads repeat
n := triad.norm; b := triad.bin
loops := concat(loopPoints(pt,n,b,r,cosSin),loops)
- reverse_! loops
+ reverse! loops
tube(curve,r,n) ==
n < 3 => error "tube: n should be at least 3"
diff --git a/src/algebra/vector.spad.pamphlet b/src/algebra/vector.spad.pamphlet
index 2d52b422..a096f39e 100644
--- a/src/algebra/vector.spad.pamphlet
+++ b/src/algebra/vector.spad.pamphlet
@@ -281,7 +281,7 @@ DirectProductCategory(dim:NonNegativeInteger, R:Type): Category ==
ans:Matrix(R) := new(dim, #v, 0)
for i in minRowIndex ans .. maxRowIndex ans repeat
for j in minColIndex ans .. maxColIndex ans repeat
- qsetelt_!(ans, i, j, qelt(qelt(v, j), i))
+ qsetelt!(ans, i, j, qelt(qelt(v, j), i))
ans
reducedSystem(m:Matrix %):Matrix(R) ==
@@ -376,7 +376,7 @@ DirectProduct(dim:NonNegativeInteger, R:Type):
for i in 1..dim repeat
(c := subtractIfCan(qelt(u, i)$Rep, qelt(v,i)$Rep)) case "failed" =>
return "failed"
- qsetelt_!(w, i, c::R)$Rep
+ qsetelt!(w, i, c::R)$Rep
w pretend %
if R has Ring then
@@ -387,7 +387,7 @@ DirectProduct(dim:NonNegativeInteger, R:Type):
w := new(dim,0)$Vector(R)
for i in minIndex w .. maxIndex w repeat
(u := recip qelt(z, i)) case "failed" => return "failed"
- qsetelt_!(w, i, u::R)
+ qsetelt!(w, i, u::R)
w pretend %
unitVector i ==
diff --git a/src/algebra/view2D.spad.pamphlet b/src/algebra/view2D.spad.pamphlet
index fc770f12..68d634e5 100644
--- a/src/algebra/view2D.spad.pamphlet
+++ b/src/algebra/view2D.spad.pamphlet
@@ -227,8 +227,8 @@ GraphImage (): Exports == Implementation where
d < 4 => p := extend(p,[daShade])
p.4 := daShade
lp2 := cons(p,lp2)
- llp2 := cons(reverse_! lp2,llp2)
- reverse_! llp2
+ llp2 := cons(reverse! lp2,llp2)
+ reverse! llp2
graph demRanges ==
null demRanges => [ 0, [], [], [], [], [], [], [] ]
diff --git a/src/algebra/view3D.spad.pamphlet b/src/algebra/view3D.spad.pamphlet
index 2b3f5e32..2fc1d5f4 100644
--- a/src/algebra/view3D.spad.pamphlet
+++ b/src/algebra/view3D.spad.pamphlet
@@ -502,7 +502,7 @@ ThreeDimensionalViewport(): Exports == Implementation where
-- if they have varying dimensionalities, give an error
s := brace()$Set(PI)
for pt in lpts repeat
- insert_!(dimension pt,s)
+ insert!(dimension pt,s)
#s > 1 => error "All points should have the same dimension"
(n := first parts s) < 3 => error "Dimension of points should be greater than 2"
sendI(VIEW,viewport.fun)$Lisp
diff --git a/src/algebra/xlpoly.spad.pamphlet b/src/algebra/xlpoly.spad.pamphlet
index 8cc83ee6..c74bbd71 100644
--- a/src/algebra/xlpoly.spad.pamphlet
+++ b/src/algebra/xlpoly.spad.pamphlet
@@ -86,7 +86,7 @@ Magma(VarSet:OrderedSet):Public == Private where
varList x ==
x case VarSet => [x::VarSet]
lv: List VarSet := setUnion(varList x.left, varList x.right)
- sort_!(lv)
+ sort!(lv)
left x ==
x case VarSet => error "x has only one entry"
@@ -322,7 +322,7 @@ LyndonWord(VarSet:OrderedSet):Public == Private where
if lexico(a,b) and (lexico(b,right a) or b = right a )
then lbase1:=cons(a*b,lbase1)
- base(ll):= sort_!(lexico, lbase1)
+ base(ll):= sort!(lexico, lbase1)
return base
LyndonWordsList (vl,n) ==
diff --git a/src/algebra/xpoly.spad.pamphlet b/src/algebra/xpoly.spad.pamphlet
index f5c9b047..e3c176c1 100644
--- a/src/algebra/xpoly.spad.pamphlet
+++ b/src/algebra/xpoly.spad.pamphlet
@@ -119,13 +119,13 @@ OrderedFreeMonoid(S: OrderedSet): OFMcategory == OFMdefinition where
rquo(w:%, l:S) ==
u:% := reverse w
(r := lquo (u,l)) case "failed" => "failed"
- reverse_! (r::%)
+ reverse! (r::%)
length x == reduce("+" ,[f.exp for f in listOfMonoms x], 0)
varList x ==
le: List S := [t.gen for t in listOfMonoms x]
- sort_! removeDuplicates(le)
+ sort! removeDuplicates(le)
first w ==
x: List REC := listOfMonoms w
@@ -343,7 +343,7 @@ FreeModule1(R:Ring,S:OrderedSet): FMcat == FMdef where
coerce(a:%):EX ==
empty? a => (0$R)::EX
- reduce(_+, reverse_! [outTerm(t.c, t.k) for t in a])$List(EX)
+ reduce(_+, reverse! [outTerm(t.c, t.k) for t in a])$List(EX)
coefficient(x,s) ==
null x => 0$R
@@ -669,7 +669,7 @@ XPolynomialRing(R:Ring,E:OrderedMonoid): T == C where
coerce(a:%):EX ==
empty? a => (0$R)::EX
- reduce(_+, reverse_! [outTerm(t.c, t.k) for t in a])$List(EX)
+ reduce(_+, reverse! [outTerm(t.c, t.k) for t in a])$List(EX)
if R has Field then
@@ -768,7 +768,7 @@ XDistributedPolynomial(vl:OrderedSet,R:Ring): XDPcat == XDPdef where
varList p ==
constant? p => []
le : List vl := "setUnion"/[varList(t.k) for t in p]
- sort_!(le)
+ sort!(le)
rquo(p:% , w: WORD) ==
[[r::WORD,t.c]$TERM for t in p | not (r:= rquo(t.k,w)) case "failed" ]
@@ -953,7 +953,7 @@ XRecursivePolynomial(VarSet:OrderedSet,R:Ring): Xcat == Xdef where
--------------------------------------------------------------
outForm(p:REGPOLY): EX ==
le : List EX := [t.k::EX * t.c::EX for t in ListOfTerms p]
- reduce(_+, reverse_! le)$List(EX)
+ reduce(_+, reverse! le)$List(EX)
coerce(p:$): EX ==
p case R => (p::R)::EX
@@ -1095,7 +1095,7 @@ XRecursivePolynomial(VarSet:OrderedSet,R:Ring): Xcat == Xdef where
p case R => []
lv: List VarSet := "setUnion"/[varList(t.c) for t in ListOfTerms p.reg]
lv:= setUnion(lv,[t.k for t in ListOfTerms p.reg])
- sort_!(lv)
+ sort!(lv)
@