Question/Feature request
Closed this issue · 4 comments
I was trying out comby and wanted to do the following refactoring:
dict(foo=bar,baz=qux)
=>
{"foo": bar, "baz": qux}
but I can't find a way to repeatedly apply a pattern within a particular scope. Am I missing how to do this, or is this not currently possible?
It's possible, but not documented yet :) What you do is use a nested rewrite rule like this: https://bit.ly/2LY8N3z
I'll update the docs in the advanced/exerpimental feature section. For future questions feel free to head over to gitter: https://gitter.im/comby-tools/community. I appreciate this question, it's helped me to refer people to gitter when starting an issue in case it's about writing a pattern. Thanks for popping in!
For posterity:
dict(:[args])
-> {:[args]}
where rewrite :[args] {
":[[k]]=:[[v]]" -> "\":[k]\": :[v]"
}
:)
That's awesome, thank you!
You are very welcome. I've updated the docs, and used your example :)