Orbital library

orbital.logic.functor
Class Functionals.Anamorphism

java.lang.Object
  extended by orbital.logic.functor.Functionals.Anamorphism
All Implemented Interfaces:
java.io.Serializable, Function, Functor
Enclosing class:
Functionals

public static class Functionals.Anamorphism
extends java.lang.Object
implements Function, java.io.Serializable

Anamorphism recursion functional scheme (lense).

An anamorphism is denoted by concave lenses.

this = |(g,p)| = 〖g,p〗

Also known as unfold.

Anamorphism are special hylomorphisms

〖g,p〗 = 〚(∅,cons),(g,p)〛

Author:
André Platzer
See Also:
Functionals.lense(Function, Predicate, Object), 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
 
Fields inherited from interface orbital.logic.functor.Function
callTypeDeclaration
 
Constructor Summary
Functionals.Anamorphism(Function g, Predicate p)
          Constructs a new anamorphism |(g,p)|:B→A*.
 
Method Summary
 java.lang.Object apply(java.lang.Object b)
          |(g,p)| b.
 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
 

Constructor Detail

Functionals.Anamorphism

public Functionals.Anamorphism(Function g,
                               Predicate p)
Constructs a new anamorphism |(g,p)|:B→A*.

Parameters:
g - is a function g:B→A×B=A||B that returns objects of type Pair.
p - is a predicate p⊆B.
Method Detail

equals

public boolean equals(java.lang.Object o)
Description copied from interface: Functor
.

Note 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.

Specified by:
equals in interface Functor
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Functor
Overrides:
hashCode in class java.lang.Object

apply

public final java.lang.Object apply(java.lang.Object b)
|(g,p)| b.
ana b = ⇐ p(b)
= [a|ana(b')] ⇐ ¬ p(b)
where (a, b') = g(b)
|(g,p)| := ana

Specified by:
apply in interface Function
Parameters:
b - a value ∈B.
Returns:
the value |(g,p)| b ∈ A* represented as a List.

toString

public java.lang.String toString()
Description copied from interface: Functor
Returns a string representation of the Functor.

This method is already provided in Object.toString(). If it is overwritten it should return a nice name for the functor.

Specified by:
toString in interface Functor
Overrides:
toString in class java.lang.Object
Returns:
a nice name for the functor.

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.