diff options
author | dos-reis <gdr@axiomatics.org> | 2009-06-11 23:00:40 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-06-11 23:00:40 +0000 |
commit | 9e07dcd91c45bf8b22d932321f5c97e931ffe8ac (patch) | |
tree | 6d2174e90e5779b1b3ab4ae7df3ae6603b66c6c2 /src/algebra/array2.spad.pamphlet | |
parent | 7bd82b57975bbc1ff5b87fed0739815c620ecdcc (diff) | |
download | open-axiom-9e07dcd91c45bf8b22d932321f5c97e931ffe8ac.tar.gz |
* algebra/: Don't quote '!' at end of names.
Diffstat (limited to 'src/algebra/array2.spad.pamphlet')
-rw-r--r-- | src/algebra/array2.spad.pamphlet | 46 |
1 files changed, 23 insertions, 23 deletions
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 == |