zxcalc / quantomatic

Quantomatic is a tool for doing automated graph rewriting.

Home Page:http://quantomatic.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simproc API : rewrite targeted w traversal

rossduncan opened this issue · comments

Add a new simproc combinator,

REWRITE_W_TRAVERSAL(rule, v, t)
takes a rule, the name of a vertex 'v' within the rule (as a string), and a "traversal" object 't' which is (effectively) a sequence of targeting functions as per REWRITE_TARGETED. If the desired rewrite cannot be performed at the desired location, then move on the next target in the traversal.

I'm imagining that the traversal will either be stateful with some method called multiple times , or be required to return a continuation which produces the next target. Either way it will probably do a lot of computation upfront.

(Also consider the possibility to update a traversal object after the rewrite has been performed to avoid recomputing things already known.)