hi,
Given bindings::Dict, expr::String, I would like to implement variable
bindings. The problem with using `replace` is that variable
identifiers can be substrings of each other.
e.g.
bindings = { "a" => "1", "ab" => "2"}
expr = "a+ab+b"
Desired output: "1+2+b"
If you tokenize expr and bind each token separately, you then have the
problem of putting them back together in the expression.
One solution would be to sort them by length, and do `replace` from
longest to shortest... but I think there must be a better solution.
Any ideas?
Gustavo
--
Gustavo Lacerda
http://www.optimizelife.com