From: Andreas Thiele
Subject: string-equal/equalp
Date: 
Message-ID: <ddsf9s$jjf$04$1@news.t-online.com>
Hi,

I can use string-equalp or equalp if I'm not interested in case when comparing strings. Is there an
advantage of using string-equal? Which one should be preferred? Just a question of style?

Andreas

From: Edi Weitz
Subject: Re: string-equal/equalp
Date: 
Message-ID: <uy8726sog.fsf@agharta.de>
On Tue, 16 Aug 2005 12:31:23 +0200, "Andreas Thiele" <··········@nospam.com> wrote:

> I can use string-equalp or equalp if I'm not interested in case when
> comparing strings. Is there an advantage of using string-equal?
> Which one should be preferred? Just a question of style?

I would assume that on most implementations STRING-EQUAL is a bit
faster (given the right optimization declarations) because it "knows"
that its arguments are strings.  It's most likely a micro-optimization
that's only noticable in tight loops.

It can also be self-documenting to use STRING-EQUAL because the reader
of your code then knows that you expect both of its arguments to be
strings.

HTH,
Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Andreas Thiele
Subject: Re: string-equal/equalp
Date: 
Message-ID: <ddst0d$m9t$04$1@news.t-online.com>
TNX
From: Kent M Pitman
Subject: Re: string-equal/equalp
Date: 
Message-ID: <uslx8tvz3.fsf@nhplace.com>
Edi Weitz <········@agharta.de> writes:

> I would assume that on most implementations STRING-EQUAL is a bit
> faster (given the right optimization declarations) because it "knows"
> that its arguments are strings.

"string designators"

People who don't know about designators in general should definitely read 

 http://www.lispworks.com/documentation/HyperSpec/Body/01_dae.htm

It's an important concept no one should be unaware of when reading the spec.

String designators are defined here:

 http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_s.htm#string_designator
From: Wade Humeniuk
Subject: Re: string-equal/equalp
Date: 
Message-ID: <gGnMe.223765$on1.123084@clgrps13>
Andreas Thiele wrote:
> Hi,
> 
> I can use string-equalp or equalp if I'm not interested in case when comparing strings. Is there an
> advantage of using string-equal? Which one should be preferred? Just a question of style?
> 
> Andreas
> 
> 

Just look at the definition (from the CLHS) at the two function
definitions,

equalp x y => generalized-boolean
string-equal string1 string2 &key start1 end1 start2 end2 => generalized boolean

STRING-EQUAL allows bounding indexes on the string (since it is a sequence)

If one needs to compare a substring of a string you would need to use
subseq (or such) to effectively use EQUALP, STRING-EQUAL would be
more efficient.

Wade
From: Andreas Thiele
Subject: Re: string-equal/equalp
Date: 
Message-ID: <ddusgt$kaa$02$1@news.t-online.com>
Thanks for your hints Wade & Edi,

I just noticed my own 'bad habit' of using equalp whenever I needed non case sensitive string
comparison. When reading your hints, they seem obvious to me.

Habit abadoned!

:)

Andreas