public abstract class Lambda extends java.lang.Object implements FV
A thing that can be applied to something.
Constructor and Description |
---|
Lambda() |
Modifier and Type | Method and Description |
---|---|
FV |
_e()
A
Lambda evaluates to itself. |
boolean |
_u()
Return
false because a lambda is a value. |
Lazy<FV> |
_v()
A
Lambda evaluates to itself. |
Lambda |
app(Lazy<FV> v)
Apply this to an argument and cast the evaluated result to a Lambda.
|
abstract Lazy<FV> |
apply(Lazy<FV> v)
Apply this to an argument.
|
int |
constructor()
constructor() returns 0 for all function values |
public final Lambda app(Lazy<FV> v)
Apply this to an argument and cast the evaluated result to a Lambda.
This is useful to avoid code like
(Lambda) (((Lambda) f.apply(x)._e()).apply(y)._e())
Rather, we just write
f.app(x).app(y)
public final int constructor()
constructor()
returns 0 for all function values
constructor
in interface FV
Because product types have only one constructor, this will return 0 for every value of a product type.
public final boolean _u()
Return false
because a lambda is a value.
_u
in interface Lazy<FV>
Unknown
and false in all other cases.
This function helps to avoid instanceof and explicit type conversions.
It is used by Unknown._e()
to decide if another invokation
of Unknown._v()
is needed.
Non-lazy values just return false.