Make all maje functions somewhat "lazy"? #48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Now that we are able to type a maje expression (i.e., deduce the type it will evaluate to without evaluating it), there is a possibility we could arrange that in maje, it's actually the subexpressions (i.e. parse trees) that are always provided as arguments to a function call. If, as in the ordinary case, the function has no implementations matching parse tree arguments, the parse trees would just be converted to their values of the computed type by an automatic conversion that evaluates the parse tree. On the other hand, for short-circuiting operations like 'and' or functions like 'derivative' that want to work on parse trees, there would be no need to mark them as "raw" functions -- they could simply define matches on the parse tree types, and then they would receive the parse trees as actual arguments in those implementations.
(I guess that
derivativeis not currently marked as raw, in thatderivative(x^2)throws an undefined symbol error in the mathjs.org REPL right now. So this feature, if we implemented it, could potentially streamline the use ofderivativefrom where it stands now.)