aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/aggcat.spad.pamphlet17
-rw-r--r--src/algebra/defaults.spad.pamphlet4
-rw-r--r--src/algebra/smith.spad.pamphlet2
-rw-r--r--src/algebra/solvelin.spad.pamphlet4
4 files changed, 11 insertions, 16 deletions
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index 0515f143..41b6ab6b 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -81,8 +81,6 @@ import Evalable
++ same type.
++ In the current system, all aggregates are homogeneous.
++ Two attributes characterize classes of aggregates.
-++ Those with attribute \spadatt{shallowlyMutable} allow an element
-++ to be modified or updated without changing its overall value.
HomogeneousAggregate(S:Type): Category == Aggregate with
if S has CoercibleTo(OutputForm) then CoercibleTo(OutputForm)
if S has BasicType then BasicType
@@ -92,9 +90,6 @@ HomogeneousAggregate(S:Type): Category == Aggregate with
map : (S->S,%) -> %
++ 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!(f,u) destructively replaces each element x of u by \axiom{f(x)}.
add
if S has Evalable S then
eval(u:%,l:List Equation S):% == map(eval(#1,l),u)
@@ -194,7 +189,6 @@ FiniteAggregate(S: Type): Category == Exports where
++ shapes.
ShallowlyMutableAggregate(S: Type): Category == Exports where
Exports == HomogeneousAggregate S with
- shallowlyMutable -- FIXME: TEMPORARY.
map!: (S->S,%) -> %
++ \spad{map!(f,u)} destructively replaces each element
++ \spad{x} of \spad{u} by \spad{f(x)}
@@ -952,7 +946,7 @@ EltableAggregate(Dom:SetCategory, Im:Type): Category ==
++ domain of \axiom{u} a memory-access violation may occur. If a check
++ on whether \axiom{x} is in the domain of \axiom{u} is required, use
++ the function \axiom{elt}.
- if % has shallowlyMutable then
+ if % has ShallowlyMutableAggregate Im then
setelt : (%, Dom, Im) -> Im
++ setelt(u,x,y) sets the image of x to be y under u,
++ assuming x is in the domain of u.
@@ -965,7 +959,7 @@ EltableAggregate(Dom:SetCategory, Im:Type): Category ==
++ If such a check is required use the function \axiom{setelt}.
add
qelt(a, x) == elt(a, x)
- if % has shallowlyMutable then
+ if % has ShallowlyMutableAggregate Im then
qsetelt!(a, x, y) == (a.x := y)
@
@@ -1027,7 +1021,7 @@ IndexedAggregate(Index: SetCategory, Entry: Type): Category ==
++ Note: for collections, \axiom{first([x,y,...,z]) = x}.
++ Error: if u is empty.
- if % has shallowlyMutable then
+ if % has ShallowlyMutableAggregate Entry then
fill!: (%,Entry) -> %
++ fill!(u,x) replaces each entry in aggregate u by x.
++ The modified u is returned as value.
@@ -1047,7 +1041,7 @@ IndexedAggregate(Index: SetCategory, Entry: Type): Category ==
minIndex a == "min"/indices(a)
first a == a minIndex a
- if % has shallowlyMutable then
+ if % has ShallowlyMutableAggregate Entry then
map(f, a) == map!(f, copy a)
map!(f, a) ==
@@ -1848,7 +1842,8 @@ LinearAggregate(S:Type): Category ==
++ insert(v,u,k) returns a copy of u having v inserted beginning at the
++ \axiom{i}th element.
++ Note: \axiom{insert(v,u,k) = concat( u(0..k-1), v, u(k..) )}.
- if % has shallowlyMutable then setelt: (%,UniversalSegment(Integer),S) -> S
+ if % has ShallowlyMutableAggregate S then
+ setelt: (%,UniversalSegment(Integer),S) -> S
++ setelt(u,i..j,x) (also written: \axiom{u(i..j) := x}) destructively
++ replaces each element in the segment \axiom{u(i..j)} by x.
++ The value x is returned.
diff --git a/src/algebra/defaults.spad.pamphlet b/src/algebra/defaults.spad.pamphlet
index fd88008b..490ae98a 100644
--- a/src/algebra/defaults.spad.pamphlet
+++ b/src/algebra/defaults.spad.pamphlet
@@ -63,7 +63,7 @@ RepeatedDoubling(S):Exports ==Implementation where
<<package FLASORT FiniteLinearAggregateSort>>=
)abbrev package FLASORT FiniteLinearAggregateSort
++ FiniteLinearAggregateSort
-++ Sort package (in-place) for shallowlyMutable Finite Linear Aggregates
+++ Sort package (in-place) for ShallowlyMutable Finite Linear Aggregates
++ Author: Michael Monagan Sep/88
++ RelatedOperations: sort
++ Description:
@@ -72,7 +72,7 @@ RepeatedDoubling(S):Exports ==Implementation where
FiniteLinearAggregateSort(S, V): Exports == Implementation where
S: Type
- V: FiniteLinearAggregate(S) with shallowlyMutable
+ V: Join(FiniteLinearAggregate S,ShallowlyMutableAggregate S)
B ==> Boolean
I ==> Integer
diff --git a/src/algebra/smith.spad.pamphlet b/src/algebra/smith.spad.pamphlet
index 4e824033..4572488d 100644
--- a/src/algebra/smith.spad.pamphlet
+++ b/src/algebra/smith.spad.pamphlet
@@ -84,7 +84,7 @@ SmithNormalForm(R,Row,Col,M) : Exports == Implementation where
km:= (km - 1) :: NNI
km
- if Col has shallowlyMutable then
+ if Col has ShallowlyMutableAggregate R then
test2(sm : M ,b : Col, n1:NNI,dk:NNI) : Union( Col, "failed") ==
-- test divisibility --
diff --git a/src/algebra/solvelin.spad.pamphlet b/src/algebra/solvelin.spad.pamphlet
index c7412659..c9e9ea7e 100644
--- a/src/algebra/solvelin.spad.pamphlet
+++ b/src/algebra/solvelin.spad.pamphlet
@@ -26,8 +26,8 @@
LinearSystemMatrixPackage(F, Row, Col, M): Cat == Capsule where
F: Field
- Row: FiniteLinearAggregate F with shallowlyMutable
- Col: FiniteLinearAggregate F with shallowlyMutable
+ Row: Join(FiniteLinearAggregate F,ShallowlyMutableAggregate F)
+ Col: Join(FiniteLinearAggregate F,ShallowlyMutableAggregate F)
M : MatrixCategory(F, Row, Col)
N ==> NonNegativeInteger