|
Orbital library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorbital.logic.functor.Functionals.Catamorphism
public static class Functionals.Catamorphism
Catamorphism recursion functional scheme (banana).
A catamorphism is denoted by bananas and is the same as the iterative foldRight.
Fusion Law:
Also known as fold, reduce. Usually implemented as a linear right tail-recurrence, however, associative f permit parallelising.
This function takes values in A* represented as a generalized iteratable,
like f.ex. Iterator.
Functionals.banana(Object, BinaryFunction, Iterator),
Functionals.foldRight(BinaryFunction, Object, Iterator),
Functionals.foldRight(BinaryFunction, Object, List),
Meijer, E. and Fokkinga, M.M. and Paterson, R., Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire, FPCA91: Functional Programming Languages and Computer Architecture, pp. 124--144, volume 523, Lecture Notes in Computer Science, Springer-Verlag, 1991.,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface orbital.logic.functor.Function |
|---|
Function.Composite |
| Nested classes/interfaces inherited from interface orbital.logic.functor.Functor |
|---|
Functor.Specification |
| Field Summary | |
|---|---|
protected java.lang.Object |
c
the right (second) argument basevalue in B to start with. |
protected BinaryFunction |
f
the function f:A×B=A||B->B used to fold the list a with. |
| Fields inherited from interface orbital.logic.functor.Function |
|---|
callTypeDeclaration |
| Constructor Summary | |
|---|---|
Functionals.Catamorphism(java.lang.Object c,
BinaryFunction f)
Constructs a new catamorphism (|c,f|):A*->B. |
|
| Method Summary | |
|---|---|
java.lang.Object |
apply(java.lang.Object a)
(|c,f|) a. |
boolean |
equals(java.lang.Object o)
. |
int |
hashCode()
|
java.lang.String |
toString()
Returns a string representation of the Functor. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final java.lang.Object c
protected final BinaryFunction f
| Constructor Detail |
|---|
public Functionals.Catamorphism(java.lang.Object c,
BinaryFunction f)
f - the function f:A×B=A||B->B used to fold the list a with.c - the right (second) argument basevalue in B to start with.
The result of the application of f will progressively build the next right (second) argument.| Method Detail |
|---|
public boolean equals(java.lang.Object o)
FunctorNote that functors will often provide intensional equality only, since the mathematical notion of extensional equality for functions and predicates is undecidable anyway (Proposition of Rice). Nevertheless implementations are encouraged to provide a larger subset of extensional equality as far as possible.
equals in interface Functorequals in class java.lang.Objectpublic int hashCode()
hashCode in interface FunctorhashCode in class java.lang.Objectpublic final java.lang.Object apply(java.lang.Object a)
| cata Ø | = | c |
| cata ([first|rest]) | = | f(first, cata(rest)) |
| (|c,f|) := cata | ||
apply in interface Functiona - a value in A* represented as a generalized iteratable,
like f.ex. Iterator.
public java.lang.String toString()
Functor
This method is already provided in Object.toString().
If it is overwritten it should return a nice name for the functor.
toString in interface FunctortoString in class java.lang.Object
|
Orbital library 1.2.0: 23 Apr 2008 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||