DirectProductFunctions2(dim, A, B)ΒΆ
vector.spad line 493 [edit on github]
dim: NonNegativeInteger
A: Type
B: Type
This package provides operations which all take as arguments direct products of elements of some type A and functions from A to another type B. The operations all iterate over their vector argument and either return a value of type B or a direct product over B.
- map: (A -> B, DirectProduct(dim, A)) -> DirectProduct(dim, B)
map(f, v)applies the functionfto every element of the vectorvproducing a new vector containing the values.
- reduce: ((A, B) -> B, DirectProduct(dim, A), B) -> B
reduce(func, vec, ident)combines the elements invecusing the binary functionfunc. Argument ident is returned if the vector is empty.
- scan: ((A, B) -> B, DirectProduct(dim, A), B) -> DirectProduct(dim, B)
scan(func, vec, ident)creates a new vector whose elements are the result of applying reduce to the binary functionfunc, increasing initial subsequences of the vectorvec, and the element ident.