Coder Social home page Coder Social logo

Comments (7)

uklimaschewski avatar uklimaschewski commented on September 17, 2024

Hi, can you g into more detail? What should be supported?
Arrays (and also structures) can be be parameters to functions already.

from evalex.

QuantumJigsaw avatar QuantumJigsaw commented on September 17, 2024

Allow to do something like this: FUNCTION([1,2,3])

from evalex.

vforvicious avatar vforvicious commented on September 17, 2024

@QuantumJigsaw you can't hardcode arrays, you have to pass it as variable Expression("FUNCTION(myArray)").with("myArray", theList).evaluate()

from evalex.

uklimaschewski avatar uklimaschewski commented on September 17, 2024

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.

QuantumJigsaw avatar QuantumJigsaw commented on September 17, 2024

@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.

uklimaschewski avatar uklimaschewski commented on September 17, 2024

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.

QuantumJigsaw avatar QuantumJigsaw commented on September 17, 2024

You are right.

I think then I will use a custom function

from evalex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.