On 07 May 2004 14:12:02 +0200, Juliusz Chroboczek wrote:
> What is the canonical name of
> #'(lambda (x y) (member x y :test 'equal))
> ?
> (eq is to memq as equal is to ...)
In Common Lisp, there is none. In some earlier Lisp versions, the
function you are asking about was called "member", but with no keyword
argument, and the #'eql test, now the default, did not even exist.
--
Dave Seaman
Judge Yohn's mistakes revealed in Mumia Abu-Jamal ruling.
<http://www.commoncouragepress.com/index.cfm?action=book&bookid=228>
JC> #'(lambda (x y) (member x y :test 'equal))
DS> In some earlier Lisp versions, the function you are asking about
DS> was called "member", but with no keyword argument, and the #'eql
DS> test, now the default, did not even exist.
Any suggestions for a good name? I'm finding myself writing the above
way too often. (Perhaps I should be interning my strings...)
Juliusz Chroboczek
In article <··············@lanthane.pps.jussieu.fr>,
Juliusz Chroboczek <···@pps.jussieu.fr> wrote:
> JC> #'(lambda (x y) (member x y :test 'equal))
>
> DS> In some earlier Lisp versions, the function you are asking about
> DS> was called "member", but with no keyword argument, and the #'eql
> DS> test, now the default, did not even exist.
>
> Any suggestions for a good name? I'm finding myself writing the above
> way too often. (Perhaps I should be interning my strings...)
(defun member-equal (x y)
(member x y :test #'equal))
--
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Barry Margolin <······@alum.mit.edu> wrote:
+---------------
| Juliusz Chroboczek <···@pps.jussieu.fr> wrote:
| > JC> #'(lambda (x y) (member x y :test 'equal))
| > Any suggestions for a good name?
|
| (defun member-equal (x y)
| (member x y :test #'equal))
+---------------
In this case that seems quite appropriate, though I often find myself
using "/" rather than "-" to indicate minor variants of functions,
e.g., "member/equal" for the above, especially when the function being
"specialized" (whoo!) already has one or more hyphens in its name, e.g.
JOIN-STRINGS vs. JOIN-STRINGS/SQL-QUOTED or:
get-bindings
get-bindings/get
get-bindings/post
and:
extract-bindings
extract-bindings/single
That sort of thing. Comments?
-Rob
-----
Rob Warnock <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
From: Christopher C. Stacy
Subject: naming conventions [Re: member :test 'equal]
Date:
Message-ID: <uu0yqmwer.fsf_-_@news.dtpq.com>
>>>>> On Fri, 07 May 2004 21:41:22 -0500, Rob Warnock ("Rob") writes:
Rob> Barry Margolin <······@alum.mit.edu> wrote:
Rob> +---------------
Rob> | Juliusz Chroboczek <···@pps.jussieu.fr> wrote:
Rob> | > JC> #'(lambda (x y) (member x y :test 'equal))
Rob> | > Any suggestions for a good name?
Rob> |
Rob> | (defun member-equal (x y)
Rob> | (member x y :test #'equal))
Rob> +---------------
Rob> In this case that seems quite appropriate, though I often find myself
Rob> using "/" rather than "-" to indicate minor variants of functions,
Rob> e.g., "member/equal" for the above, especially when the function being
Rob> "specialized" (whoo!) already has one or more hyphens in its name, e.g.
Rob> JOIN-STRINGS vs. JOIN-STRINGS/SQL-QUOTED or:
Rob> get-bindings
Rob> get-bindings/get
Rob> get-bindings/post
Rob> and:
Rob> extract-bindings
Rob> extract-bindings/single
Rob> That sort of thing. Comments?
First impression: It's different than what I've been seeing
for the last quarter century (just FOO-BAR-BAZ, with maybe
some prepositional words), so I probably won't adopt it.
In isolation, there is nothing objectionable about it.
The examples you've shown would not be at all confusing if I came
across them in a pile of self-contained that all looked like that.
But I am not sure how aesthetically pleasing it would be to see
that convention mixed with code from the more usual convention.
If "everybody" did this, that (more confusing looking) mixed
conventions would be the norm, rather than your own idiosyncracy.
I don't think the level of discrepancy would ever die all the
way down, because there will always be code that just uses hyphens.
I'm don't want to introduce additional punctuation like that.
I think there's already a convention for that meaning, and when
I see things like "/" and "+" (and "*") in the names of things,
they draw my attention and make me wonder what's so special about
those names. It's very much like the other kind of syntactic
markers (reader macros) in the language.
Of course the meaning of "minor variant" is very subjective.
Also, I fear that someone would write things like
FROB-THIS/LIKE/THAT/WITH-FROBBING
and I think that actually looks ugly. Sorta reminds me of natural
lanugage parsers from MACLISP days before strings were invented,
or some name that was consed by a program and not normally intended
for program-writer consumption. And that kind of of hierarchical
naming system starts to look a lot like other naming conventions.
Introducing yet another such naming system is not a good idea.
Especially since we're still talking about code where we don't
want to make such boundary distinctions -- we're talking about
program elements that are conceptually at the same level,
not something that wants to be hierarchically distinct.
····@rpw3.org (Rob Warnock) wrote in message news:<······················@speakeasy.net>...
>
>
> get-bindings
> get-bindings/get
> get-bindings/post
> and:
> extract-bindings
> extract-bindings/single
>
> That sort of thing. Comments?
>
I do that too, although I'm told I should really say extractBindingsSingle.
Juliusz Chroboczek <···@pps.jussieu.fr> writes:
> JC> #'(lambda (x y) (member x y :test 'equal))
>
> DS> In some earlier Lisp versions, the function you are asking about
> DS> was called "member", but with no keyword argument, and the #'eql
> DS> test, now the default, did not even exist.
>
> Any suggestions for a good name? I'm finding myself writing the above
> way too often. (Perhaps I should be interning my strings...)
memual?
Christophe
--
http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)
Christophe Rhodes wrote:
> Juliusz Chroboczek <···@pps.jussieu.fr> writes:
>>Any suggestions for a good name? I'm finding myself writing the above
>>way too often. (Perhaps I should be interning my strings...)
>
> memual?
"Much of the skill in writing unmaintainable code is the art of naming
variables and methods. They don't matter at all to the compiler. That
gives you huge latitude to use them to befuddle the maintenance programmer."
- How to Write Unmaintainable Code
Ari Johnson wrote:
> Christophe Rhodes wrote:
>
>> Juliusz Chroboczek <···@pps.jussieu.fr> writes:
>>
>>> Any suggestions for a good name? I'm finding myself writing the above
>>> way too often. (Perhaps I should be interning my strings...)
>>
>>
>> memual?
>
>
> "Much of the skill in writing unmaintainable code is the art of naming
> variables and methods. They don't matter at all to the compiler. That
> gives you huge latitude to use them to befuddle the maintenance
> programmer."
> - How to Write Unmaintainable Code
So... mual?
kenny
--
Home? http://tilton-technology.com
Cells? http://www.common-lisp.net/project/cells/
Cello? http://www.common-lisp.net/project/cello/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Your Project Here! http://alu.cliki.net/Industry%20Application
Kenny Tilton <·······@nyc.rr.com> wrote:
> Ari Johnson wrote:
>> Christophe Rhodes wrote:
>>> Juliusz Chroboczek <···@pps.jussieu.fr> writes:
>>>
>>>> Any suggestions for a good name? I'm finding myself writing the above
>>>> way too often. (Perhaps I should be interning my strings...)
>>>
>>> memual?
>>
>> "Much of the skill in writing unmaintainable code is the art of naming
>> variables and methods. They don't matter at all to the compiler. That
>> gives you huge latitude to use them to befuddle the maintenance
>> programmer."
>> - How to Write Unmaintainable Code
>
> So... mual?
moo. For "Member, Object equals Other one".
--
Karl A. Krueger <········@example.edu>
Woods Hole Oceanographic Institution
Email address is spamtrapped. s/example/whoi/
"Outlook not so good." -- Magic 8-Ball Software Reviews
Karl A. Krueger wrote:
> Kenny Tilton <·······@nyc.rr.com> wrote:
>
>>Ari Johnson wrote:
>>
>>>Christophe Rhodes wrote:
>>>
>>>>Juliusz Chroboczek <···@pps.jussieu.fr> writes:
>>>>
>>>>
>>>>>Any suggestions for a good name? I'm finding myself writing the above
>>>>>way too often. (Perhaps I should be interning my strings...)
>>>>
>>>>memual?
>>>
>>>"Much of the skill in writing unmaintainable code is the art of naming
>>>variables and methods. They don't matter at all to the compiler. That
>>>gives you huge latitude to use them to befuddle the maintenance
>>>programmer."
>>> - How to Write Unmaintainable Code
>>
>>So... mual?
>
>
> moo. For "Member, Object equals Other one".
Well, we want to make it obvious that we're dealing with the "equal"
operator, so how about mmmmmmmmmmm-equal or, to make the pronunciation
more obvious, just call it homer-simpson.
Ari Johnson <·····@hotmail.com> wrote:
> Karl A. Krueger wrote:
>> Kenny Tilton <·······@nyc.rr.com> wrote:
>>
>>>Ari Johnson wrote:
>>>
>>>>Christophe Rhodes wrote:
>>>>
>>>>>Juliusz Chroboczek <···@pps.jussieu.fr> writes:
>>>>>
>>>>>
>>>>>>Any suggestions for a good name? I'm finding myself writing the above
>>>>>>way too often. (Perhaps I should be interning my strings...)
>>>>>
>>>>>memual?
>>>>
>>>>"Much of the skill in writing unmaintainable code is the art of naming
>>>>variables and methods. They don't matter at all to the compiler. That
>>>>gives you huge latitude to use them to befuddle the maintenance
>>>>programmer."
>>>> - How to Write Unmaintainable Code
>>>
>>>So... mual?
>>
>> moo. For "Member, Object equals Other one".
>
> Well, we want to make it obvious that we're dealing with the "equal"
> operator, so how about mmmmmmmmmmm-equal or, to make the pronunciation
> more obvious, just call it homer-simpson.
donuts is easier to type, and has the advantage of sounding like it
iterates over nuts.
--
Karl A. Krueger <········@example.edu>
Woods Hole Oceanographic Institution
Email address is spamtrapped. s/example/whoi/
"Outlook not so good." -- Magic 8-Ball Software Reviews
In article <··············@lanthane.pps.jussieu.fr>,
Juliusz Chroboczek <···@pps.jussieu.fr> wrote:
> KK> moo. For "Member, Object equals Other one".
>
> I rather like this one.
>
> Juliusz
But wouldn't that abbreviation be just as valid for "Member, Object eq
Other one"? The abbreviation makes no distinction between EQ, EQL,
EQUAL, or EQUALP. In fact, it doesn't even use the E, so it would also
be a reasonable mnemonic for "Member, Object unequal to Other one".
--
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Barry Margolin wrote:
> In article <··············@lanthane.pps.jussieu.fr>,
> Juliusz Chroboczek <···@pps.jussieu.fr> wrote:
>
>> KK> moo. For "Member, Object equals Other one".
>>
>> I rather like this one.
>>
>> Juliusz
>
> But wouldn't that abbreviation be just as valid for "Member, Object eq
> Other one"? The abbreviation makes no distinction between EQ, EQL,
> EQUAL, or EQUALP. In fact, it doesn't even use the E, so it would also
> be a reasonable mnemonic for "Member, Object unequal to Other one".
That's the great part, and of course the standard doesn't specify *which*
moo you're dealing with.
We can have #'moo as equal, #'moe as eq/eql and #'mee to ask whether #'moe
uses eq or eql at the moment.
Ari Johnson <·····@hotmail.com> writes:
> Christophe Rhodes wrote:
> > Juliusz Chroboczek <···@pps.jussieu.fr> writes:
> >>Any suggestions for a good name? I'm finding myself writing the above
> >>way too often. (Perhaps I should be interning my strings...)
> > memual?
>
>
> "Much of the skill in writing unmaintainable code is the art of naming
> variables and methods. They don't matter at all to the compiler. That
> gives you huge latitude to use them to befuddle the maintenance
> programmer."
>
> - How to Write Unmaintainable Code
Paul Graham in _On Lisp_ (section 16.1):
The simplest use of macros is as abbreviations. Some Common Lisp
operators have rather long names. Ranking high among them (though
by no means the longest) is destructuring-bind, which has 18
characters. A corollary of Steele's principle (page 43) is that
commonly used operators ought to have short names. ("We think of
addition as cheap partly because we can notate it with a single
character: '+'") The built-in destructuring-bind macro introduces
a new layer of abstraction, but the actual gain in brevity is
masked by its long name:
(let ((a (car x)) (b (cdr x))) ...)
(destructuring-bind (a . b) x ...)
A program, like printed text, is easiest to read when it contains no
more than about 70 characters per line. We begin at a disadvantage
when the lengths of individual names are a quarter of that.
Of course, how often do people actually use "destructuring-bind"? And
for "memual":
memq ;memq => (member :test #'eq)
member/equal
member-equal
mem-equal
memequal
memqual ;memqual => (member :test #'equal)
memual
It's not like "memual" is really gaining much over "member-equal" or
"member/equal". Actually, I don't really think "memqual" is really
all that bad, if one already accepts "memq", as it mirros the "eq"
through "equalp" hierarchy:
memq
memql
memqual
memqualp
<shrug>