discopy icon indicating copy to clipboard operation
discopy copied to clipboard

Substitution of nested diagrams

Open toumix opened this issue 10 months ago • 1 comments

For now we have a substitution method f.substitute(g, i) which works with plain diagrams but it's not possible to substitute within a bubble. This substitution method can be extended by using a vector of indices i0, i1, ... rather than a single index: if f.boxes[i0] is a bubble then we can provide an extra index to a box inside it, i.e. f.boxes[i0].inside.boxes[i1]. The syntax can be the same but with extra arguments f.substitute(g, i0, i1).

toumix avatar Feb 24 '25 09:02 toumix

I think it's nice because it works with any box and nesting level. I'll send a PR.

colltoaction avatar Feb 24 '25 10:02 colltoaction