/usr/share/axiom-20170501/src/algebra/FSAGG2.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 44 45 46 47 48 49 50 51 52 | )abbrev package FSAGG2 FiniteSetAggregateFunctions2
++ Author: Robert S. Sutor
++ Date Created: 15 May 1990
++ Date Last Updated: 14 Oct 1993
++ Description:
++ FiniteSetAggregateFunctions2 provides functions involving two
++ finite set aggregates where the underlying domains might be
++ different. An example of this is to create a set of rational
++ numbers by mapping a function across a set of integers, where the
++ function divides each integer by 1000.
FiniteSetAggregateFunctions2(S, A, R, B) : SIG == CODE where
S : SetCategory
A : FiniteSetAggregate S
R : SetCategory
B : FiniteSetAggregate R
SIG ==> with
map : (S -> R, A) -> B
++ map(f,a) applies function f to each member of
++ aggregate \spad{a}, creating a new aggregate with
++ a possibly different underlying domain.
reduce : ((S, R) -> R, A, R) -> R
++ reduce(f,a,r) applies function f to each
++ successive element of the aggregate \spad{a} and an
++ accumulant initialised to r.
++ For example,
++ \spad{reduce(_+$Integer,[1,2,3],0)}
++ does a \spad{3+(2+(1+0))}.
++ Note that third argument r may be regarded
++ as an identity element for the function.
scan : ((S, R) -> R, A, R) -> B
++ scan(f,a,r) successively applies \spad{reduce(f,x,r)}
++ to more and more leading sub-aggregates x of
++ aggregate \spad{a}.
++ More precisely, if \spad{a} is \spad{[a1,a2,...]}, then
++ \spad{scan(f,a,r)} returns
++ \spad{[reduce(f,[a1],r),reduce(f,[a1,a2],r),...]}.
CODE ==> add
map(fn, a) ==
set(map(fn, parts a)$ListFunctions2(S, R))$B
reduce(fn, a, ident) ==
reduce(fn, parts a, ident)$ListFunctions2(S, R)
scan(fn, a, ident) ==
set(scan(fn, parts a, ident)$ListFunctions2(S, R))$B
|