Skip to content
Discussion options

You must be logged in to vote

That is an interesting case. When serializing (see docs), only data types can be serialized, and not functions. JavaScript functions can have bindings from outside, which would break when serializing. So it's not trivial to restore such a function. Also functions created inside the expression parser itself do have bindings.

A pragmatic solution for now could be to create a wrapper around the function evaluate, remember all expressions passed to evaluate, and simply store the orginal expressions. To restore this, all expressions can be executed again.

Fo the long term: a solution could be to extend functions created in the exprssion parser with a method .toJSON into something like {"mathjs…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@dpnova
Comment options

@josdejong
Comment options

@josdejong
Comment options

@dpnova
Comment options

@josdejong
Comment options

Answer selected by dpnova
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants