Re: shootout: implementing an interpreter for a simple procedural language Minim
- From: Jon Harrop <jon@xxxxxxxxxxxxxxxxx>
- Date: Sat, 28 Jul 2007 00:06:48 +0100
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
http://www.ffconsultancy.com/products/ocaml_for_scientists/?usenet
.
- Follow-Ups:
- References:
- Prev by Date: ALIW (A Lisp in Wonderland) Wiki Project
- Next by Date: Re: CFFI tests problem
- Previous by thread: Re: shootout: implementing an interpreter for a simple procedural language Minim
- Next by thread: Re: shootout: implementing an interpreter for a simple procedural language Minim
- Index(es):