If there is a particular vertex that should match any node with a
non-zero angle, you can use REWRITE_TARGETED for this. Supposing its
v0 in your pattern that should match, you can use something like this:
def first_nonzero_green(g):
for v in verts(g):
if not vertex_angle_is(g, v, '0') and g.typeOf(v) == 'Z': return v
return None
simproc = REPEAT(REWRITE_TARGETED(rule, 'v0', nonzero) >> REDUCE(simps))
The only issue is this won't try to do the match for any nonzero green
node, but just the first one. If that's something you need, I can
probably extend REWRITE_TARGETED.
> --
> You received this message because you are subscribed to the Google Groups "Quantomatic" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
quantomatic...@googlegroups.com.
> To post to this group, send email to
quant...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/quantomatic.
> For more options, visit
https://groups.google.com/d/optout.