A lazy monadic expression function.
TODO need to mark whether this function is exact or not (but I can't think of many which are exact).
TODO implement also for other Valuables than Numbers.
Value parameters
- f
-
the function Number => Number.
- name
-
the name of this function.
Attributes
Members list
Value members
Abstract methods
Attempts to evaluate the given Valuable exactly using this ExpressionMonoFunction. If the operation can be performed exactly, it returns the resulting Valuable wrapped in an Option. If the operation cannot be performed exactly, it returns None.
Attempts to evaluate the given Valuable exactly using this ExpressionMonoFunction. If the operation can be performed exactly, it returns the resulting Valuable wrapped in an Option. If the operation cannot be performed exactly, it returns None.
Value parameters
- x
-
the input parameter of type
Valuableto be evaluated.
Attributes
- Returns
-
an
Optioncontaining the exact result as aValuableif the evaluation succeeds, orNoneif it does not.
Specifies the context in which the parameter of the function f must be evaluated.
Specifies the context in which the parameter of the function f must be evaluated.
Value parameters
- context
-
the
Contextin which thisExpressionMonoFunctionmust be evaluated.
Attributes
- Returns
-
the
Contextto be used when evaluating the parameter.
Concrete methods
Evaluate this function on Valuable x.
Evaluate this function on Valuable x.
Value parameters
- x
-
the parameter to the function.
Attributes
- Returns
-
the result of f(x).
Applies the mathematical operation encapsulated by this ExpressionMonoFunction to the given complex number. The operation is determined based on the specific subtype or case of this function instance.
Applies the mathematical operation encapsulated by this ExpressionMonoFunction to the given complex number. The operation is determined based on the specific subtype or case of this function instance.
Value parameters
- z
-
the input complex number of type
algebra.eager.Complexto which the operation will be applied
Attributes
- Returns
-
an
Option[Eager]containing the result of applying the operation as anEagerinstance, orNoneif the operation is not supported for this function instance
Evaluates the given Expression in the specified Context and attempts to derive an Eager result. This method relies on the Expression being evaluated as-is and applies this function's exact logic if applicable.
Evaluates the given Expression in the specified Context and attempts to derive an Eager result. This method relies on the Expression being evaluated as-is and applies this function's exact logic if applicable.
CONSIDER the alternative version (commented out) which seems like it should be correct but isn't.
Value parameters
- a
-
the
Expressionto be evaluated. - context
-
the
Contextwithin which the evaluation is performed.
Attributes
- Returns
-
an
Option[Eager]containing the result of the evaluation if successful, orNoneotherwise.
Generate helpful debugging information about this ExpressionMonoFunction.
Generate helpful debugging information about this ExpressionMonoFunction.
Attributes
- Returns
-
a String.
- Definition Classes
-
Function1 -> Any
Inherited methods
Composes two instances of Function1 in a new Function1, with this function applied first.
Composes two instances of Function1 in a new Function1, with this function applied first.
Type parameters
- A
-
the result type of function
g
Value parameters
- g
-
a function R => A
Attributes
- Returns
-
a new function
fsuch thatf(x) == g(apply(x)) - Inherited from:
- Function1
Composes two instances of Function1 in a new Function1, with this function applied last.
Composes two instances of Function1 in a new Function1, with this function applied last.
Type parameters
- A
-
the type to which function
gcan be applied
Value parameters
- g
-
a function A => T1
Attributes
- Returns
-
a new function
fsuch thatf(x) == apply(g(x)) - Inherited from:
- Function1