Subject: Re: debugging anonymous lambda forms
From: Erik Naggum <erik@naggum.no>
Date: 1999/03/26
Newsgroups: comp.lang.lisp
Message-ID: <3131451053382297@naggum.no>

* "Will Fitzgerald" <fitzgerald@neodesic.com>
| based on a comment--I think by Olin Shivers in discussions about a
| standard list library for Scheme--that when you see a predicate like EQL
| embedded in a function, you're not capturing the right abstraction--it's
| like having any other constant embedded in your function.

  Scheme has to do it that way because it has so weak lambda lists, with
  neither optional nor keyword arguments, and no macro system to build
  them, either.

  I prefer to use KEY and TEST keyword arguments that default to #'IDENTITY
  and #'EQL.

(defun duplic8 (element list &key (test #'eql) (key #'identity))
  (loop for x in list
     collect x
     when (funcall test (funcall key x) element) collect x))

  incidentally, "any other constant embedded in your function" does not
  sound like a real argument, since functions by their very nature must
  have a number of constants.

#:Erik