Filtering Lists



On Fri, Oct 26, 2007 at 12:41:59AM -0700, Richard Fateman wrote:
> There may be simpler ways, if maxima implemented "push" or for that
> matter, "filter".

Here's a naive attempt at implementing FILTER:

    :lisp (defmfun $filter (p l) (cons '(mlist) (remove-if-not p (cdr l))))

It even appears to work:

    (%i66) filter(evenp, [1, 2, 3]);
    (%o66) [2]

Am I missing anything?