public interface Function
Modifier and Type | Method and Description |
---|---|
double |
eval(List<Expression> args)
Executes the function with the given arguments.
|
int |
getNumberOfArguments()
Returns the number of expected arguments.
|
boolean |
isNaturalFunction()
A natural function returns the same output for the same input.
|
int getNumberOfArguments()
If the function is called with a different number of arguments, an error will be created
In order to support functions with a variable number of arguments, a negative number can be returned. This will essentially disable the check.
double eval(List<Expression> args)
The arguments need to be evaluated first. This is not done externally to permit functions to perform lazy evaluations.
args
- the arguments for this function. The length of the given list will exactly match
getNumberOfArgumentsboolean isNaturalFunction()
All classical mathematical functions are "natural". A function which reads user input is not natural, as the function might return different results depending on the users input
Copyright © 2020. All rights reserved.