public abstract class Lam1 extends Lambda
Frege lambdas with arity 1.
Like with Prod1
, Prod2
, ... each lambda type is
independent from each other,
though Lami uses Lami-1,
except Lam1 which uses Unknown
.
Function values are immutable and thus can be reused as often as one needs them. If the frege function type involves no constraints, then a single function object is sufficient for all possible instantiations of the type variables, see below.
public final Unknown<FV> apply(Lazy<FV> arg)
Apply this function to an argument.
This method creates an instance of Unknown
that
will pass the argument to the eval(frege.rt.Lazy<frege.rt.FV>)
method of this function
when evaluated.
public abstract Lazy<FV> eval(Lazy<FV> arg)
Run the function.
This method will be called by the Unknown._v()
method
of the lazy value returned by apply(frege.rt.Lazy<frege.rt.FV>)
when that lazy value
is evaluated. It actually performs computation and
returns a result or another lazy value that will evaluate to the result.
It must be implemented by all subclasses.
Once a function is instantiated, its work-method may be invoked directly. Specifically, the following identities hold:
f.eval(x) = f.a(x)._v() f.eval(x)._e() = f.a(x)._e()but the expressions on the left save creation and destruction of an Unknown instance.