Comments (7)
Hi, can you g into more detail? What should be supported?
Arrays (and also structures) can be be parameters to functions already.
from evalex.
Allow to do something like this: FUNCTION([1,2,3])
from evalex.
@QuantumJigsaw you can't hardcode arrays, you have to pass it as variable Expression("FUNCTION(myArray)").with("myArray", theList).evaluate()
from evalex.
I see what you mean, there was a similar discussion about supporting date-time data values using literals.
For date-time and duration, we introduced constructor functions, e.g. DT_DATE_NEW(2023, 12,4)
, to create a new date type.
Similar could be very easily done with a constructor function for arrays, e.g. ARR_NEW(1,2,3,4)
, or ARR_NEW("A", "b", "C")
.
Supporting array literals would be much harder to implement, probably only possible with a new major version release of EvalEx.
What do you think of that possibility?
from evalex.
@uklimaschewski Maybe I have the wrong idea but what I would expect to happen was for the array to get flatten as function parameters.
E.g.
FUNCTION([1,2])
Node:
- Token: FUNCTION
- Parameters: 1, 2
So the only thing that would need to be update was the Shunting Yard as from there the array would be threated as multiple literals.
from evalex.
But then the function would not receive an array as a parameter, but multiple parameters.
Imagine you would want to write a function that adds two arrays, element by element, and return the resulting array:
ARR_ADD([1,2,3], [4,5,6])
That would result into ARR_ADD(1,2,3,4,5,6)
, which is not what you would expect.
from evalex.
You are right.
I think then I will use a custom function
from evalex.
Related Issues (20)
- Equality depends on input type in 3.1.0
- problem with placeholder HOT 1
- Add module-info (or at least Automatic-Module-Name) HOT 2
- SQRT function doesn't work HOT 3
- With introduction of null, it's better to allow short circuiting (lazy evaluation) for those boolean operators HOT 4
- Equals/NotEquals operator is now sometimes showing inconsistent behavior HOT 1
- Broken boolean expression evaluation in version 3.1.0
- Allow Java arrays as input parameters
- Restore compatibility with Java 8 HOT 2
- Determine evaluation result type without evaluating HOT 2
- Java exception generated when trying to calculate expressions (it worked before with the original EvalEX library in the previous GitHub) HOT 2
- Can arrayJson filtering be supported? HOT 6
- Add a configurable locale to the configuration
- New Player Guidebook Naming rules HOT 1
- Incorrect behavior of ‘==’ operator in IF() expression for Array typed variable
- Management of the exception IndexOutOfBoundsException for Array variables
- Definition domain of the ACOS function
- does not evaluate if expression operand has a period, hyphen seperater HOT 2
- `SQRT` Javadoc issue.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evalex.