: replace-all ( long-str seq-of-pairs -- str ) ! "some string" { { "om" "mop!" } { "s" "B" } } dupd [ [ first ] [ second ] bi (1action) nip ] with map [ [ , ] curry ] map concat choice* replace ; ! Truth is I'm not sure pegs are suitable here, since the input changes, and it compiles again. ! probably not suitable for runtime input. (but I don't know enough to say)