Skip to content

Variadic functions for math and tinyexpr rewrite. #8644

@juntuu

Description

@juntuu

Hi,

I've played around with the tinyexpr included in fish. I rewrote it here using more of c++ (than the very c-like code), and added variadic function support.

Changes:

  • direct evaluation since fish didn't use any features (e.g. variables) that required separate parse or optimise steps
  • support for variadic functions (and example functions minimum and maximum)
  • functions are stored in a std::unordered_map, so that alphabetical order is no longer required and the lookup is simpler

Would this be of interest to you? If you'd like, I could open a pull request.

The current implementation of variadic functions doesn't support reporting errors from the functions, which might be good to have at some point. Also a question: Should some existing functions be made variadic, or should some variadic functions be added?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions