[Maxima] Filtering Lists
pcd at wikitex.org
Fri Oct 26 05:01:50 CDT 2007
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]);
Am I missing anything?
More information about the Maxima