[#26] improve efficiency of Variable lookup in Indigo
Description
To take full advantage of instructions that "jump" in the stack this was implemented:
- ability to find the (Peano) depth of a Var in the stack
- a new
replaceN
macro that replaces the nth element in the stack with the topmost one - a new
updateN
macro that replaces the nth element in the stack with the result of an instruction (applied to the topmost element and the nth element itself) -
Data.Constraint
-based functions that provide proof for the two new macros andduupX
- replacements for
lookupVar
that can get/set/update using the 3 macros mentioned above
Related issue(s)
Resolves #26 (closed)
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.
Edited by Pinto Pasquale