numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
205 stars 120 forks source link

How to provide evaluation context to arguments? #985

Open christianp opened 1 year ago

christianp commented 1 year ago

There are some cases where it would be convenient for the evaluation of a token to depend on the context it's evaluated in.

Examples:

At the moment, when an argument of an operation is evaluated, it doesn't have any access to its parents in the expression tree.

I can think of two solutions, both of which require the context-changing operation to be lazily evaluated:

This might end up being related to #677 - parsers for different kinds of notation.