Consider string matching, regular expression matching (or lexing), and parsing. Traditional techniques involve compiling the language (string, regexp, grammar) into tables, then running an abstract machine driven by these tables. RTCG can be used to compile these tables (programs for the abstract machines) into executable code, resulting in faster execution.
In fact, PE has been shown to be sometimes able to generate the tables themselves for KMP string matching [?] and parsing [?].
Formatting (unparsing) is another important operation. In C it is
printf, in lisp with
format. The languages defined
by these format strings can be quite powerful, and it makes sense to
compile them. Eg say you want to print a number with some surrounding
text. It is easier to say
(format #t "good ~d bad~%" num) than
(write-string "good ") (write-decimal num) (write-string " bad\n")but the latter runs faster. This is a familiar programmer's dilemma. By compiling the format string, you can have the best of both worlds.
If these sorts of procedures are implemented as stream processors, then they can be further composed.
Ideal protocol usage is measured against Kolmogorov complexity [ref], which requires transmitting programs.
[corollary to the end-to-end principle?]