Skip to content

[#26] improve efficiency of Variable lookup in Indigo

Pinto Pasquale requested to merge pasqu4le/#26-better-variable-lookup into master

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 and duupX
  • 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

    • I checked whether I should update the docs and did so if necessary:
    • I updated the changelog if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Pinto Pasquale

Merge request reports