Re: Remove-common function in Lisp
- From: Kent M Pitman <pitman@xxxxxxxxxxx>
- Date: 11 Apr 2008 10:06:03 -0400
Alan Crowe <alan@xxxxxxxxxxxxxxxxxxxxxxx> writes:
CL-USER> (defun purge (suspect black-list)
"list reliable comrades"
(let (reliable)
;; Check all suspect comrades against the blacklist
;; returning the reliable ones
(dolist (comrade suspect reliable)
(unless (find comrade black-list)
(push comrade reliable)))))
PURGE
CL-USER> (purge '(a b c d e) '(b d))
(E C A)
Actually it is not clear to me that "going too far" does any
real harm. I'm guilty of using generic names. Sometimes I
make a bit of an effort to choose more suggestive names and
it always pays off. Has any-one actually overdone it on real
code, permitting them to say "it hurts you like this ..."
Well, there are certainly ways you can run afoul of things. You can
confuse and side-track people with overly obscure metaphors:
(defun purge (dromedary newsgroup) ...)
and can offend people with others [I'll let you use your imagination
there].
You could even lay a trap where a confusion that comes later, as in:
(defpackage "CROWE-UTILS"
(:export "PURGE"))
...
(defpackage "CRIME-SCENE-INVESTIGATION"
(:nicknames "CSI")
(:use "CROWE-UTILS"))
(in-package "CSI")
(defclass suspect ...)
and then someone starts to type "(purge" and presses control-shift-A
in Emacs to see what the arglist of purge is and finds he must give
a SUSPECT as a first argument. That could confuse your user as to whether
that's a role or an actual instantiable object. Hard to see how to predict
that this was coming unless you want to bet against the success and broad
use of your program. Even just
(defun cons (car cdr) ...)
in an automobile factory could cause a bit of consternation if you assume
the only knowledge the programmer has is of cars and none of Lisp. I guess
the whole point of understanding packages is to help people come to grips
with the fact that these things happen.
One slightly more substantive risk is not "going too far" but picking
a word that appears to have extra out-of-band meaning. In your
example, you suggest a metaphor of a system in which there was a
suspect and a black-list, but such societies (we have one now) do lots
of record-keeping, and this could cause someone to believe there was
not just functional effect but memory [persistent state beyond the
call] involved in "reporting" a suspect. (Maybe a minor stretch in
this example, but easily within the realm of reason in other
applications I've seen.) So pick your metaphor carefully to convey
the extra baggage you want and not the baggage you don't.
On the whole, I think these pitfalls are usually worth the risk, and I
agree that a robust metaphor is often best. Leadership is about
establishing a vision. You can change the vision if it turns out not
to work out, but it's useful to have something clear you're rallying to.
.
- References:
- Remove-common function in Lisp
- From: rahul . mallo
- Re: Remove-common function in Lisp
- From: Alan Crowe
- Remove-common function in Lisp
- Prev by Date: Re: Help with lambda expression
- Next by Date: Re: Help with lambda expression
- Previous by thread: Re: Remove-common function in Lisp
- Next by thread: Re: Remove-common function in Lisp
- Index(es):
Relevant Pages
|