Re: shootout: implementing an interpreter for a simple procedural language Minim

Andy Freeman wrote:
Harrop may believe that macros "a very rudimentary form of term
rewriter", but he's wrong.

Then you'll be able to translate this Mathematica term rewriter into a
similarly-elegant Lisp macro. This finds all sublists that are flanked by
the same element:

ReplaceList[{a, b, c, a, d, b, d}, {___, x_, y__, x_, ___} -> g[x, {y}]]
{g[a, {b, c}], g[b, {c, a, d}], g[d, {b}]}

Dr Jon D Harrop, Flying Frog Consultancy
OCaml for Scientists