/usr/share/axiom-20170501/src/algebra/SEG2.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | )abbrev package SEG2 SegmentFunctions2
++ Date Last Updated: June 4, 1991
++ Description:
++ This package provides operations for mapping functions onto segments.
SegmentFunctions2(R,S) : SIG == CODE where
R : Type
S : Type
SIG ==> with
map : (R -> S, Segment R) -> Segment S
++ map(f,l..h) returns a new segment \spad{f(l)..f(h)}.
if R has OrderedRing then
map : (R -> S, Segment R) -> List S
++ map(f,s) expands the segment s, applying \spad{f} to each
++ value. For example, if \spad{s = l..h by k}, then the list
++ \spad{[f(l), f(l+k),..., f(lN)]} is computed, where
++ \spad{lN <= h < lN+k}.
CODE ==> add
map(f : R->S, r : Segment R): Segment S ==
SEGMENT(f lo r,f hi r)$Segment(S)
if R has OrderedRing then
map(f : R->S, r : Segment R): List S ==
lr := nil()$List(S)
l := lo r
h := hi r
inc := (incr r)::R
if inc > 0 then
while l <= h repeat
lr := concat(f(l), lr)
l := l + inc
else
while l >= h repeat
lr := concat(f(l), lr)
l := l + inc
reverse_! lr
|