> Programming Languages > Lisp
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on Lisp



Lisp - "member :test 'equal" in Programming Languages


Old 05-07-2004   #1
..liu.. ..robocz..
 
Default member :test 'equal

What is the canonical name of

#'(lambda (x y) (member x y :test 'equal))

?

(eq is to memq as equal is to ...)

Juliusz Chroboczek
 
Old 05-07-2004   #2
.... ..am..
 
Default Re: member :test 'equal

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>
 
Old 05-07-2004   #3
..liu.. ..robocz..
 
Default Re: member :test 'equal

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

 
Old 05-07-2004   #4
..r.. ..rgol..
 
Default Re: member :test 'equal

In article <tpr7tww9gv.fsf@lanthane.pps.jussieu.fr>,
Juliusz Chroboczek <jch@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, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
 
Old 05-07-2004   #5
..ristop.. ..od..
 
Default Re: member :test 'equal

Juliusz Chroboczek <jch@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)
 
Old 05-07-2004   #6
..i ..hns..
 
Default Re: member :test 'equal

Christophe Rhodes wrote:
> Juliusz Chroboczek <jch@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
 
Old 05-07-2004   #7
..n.. ..lt..
 
Default Re: member :test 'equal



Ari Johnson wrote:

> Christophe Rhodes wrote:
>
>> Juliusz Chroboczek <jch@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

 
Old 05-07-2004   #8
.... .. ..ueg..
 
Default Re: member :test 'equal

Kenny Tilton <ktilton@nyc.rr.com> wrote:
> Ari Johnson wrote:
>> Christophe Rhodes wrote:
>>> Juliusz Chroboczek <jch@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 <kkrueger@example.edu>
Woods Hole Oceanographic Institution
Email address is spamtrapped. s/example/whoi/
"Outlook not so good." -- Magic 8-Ball Software Reviews
 
Old 05-08-2004   #9
..i ..hns..
 
Default Re: member :test 'equal

Karl A. Krueger wrote:
> Kenny Tilton <ktilton@nyc.rr.com> wrote:
>
>>Ari Johnson wrote:
>>
>>>Christophe Rhodes wrote:
>>>
>>>>Juliusz Chroboczek <jch@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.
 
Old 05-08-2004   #10
..b ..rno..
 
Default Re: member :test 'equal

Barry Margolin <barmar@alum.mit.edu> wrote:
+---------------
| Juliusz Chroboczek <jch@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@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607

 

Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0