From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: `compare-strings' style question Date: Thu, 19 Nov 2009 17:17:22 +0100 Organization: Organization?!? Message-ID: <87einuij59.fsf@lola.goethe.zz> References: <878we2kakq.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1258649870 4698 80.91.229.12 (19 Nov 2009 16:57:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Nov 2009 16:57:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 19 17:57:43 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NBAKB-0006QW-9R for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Nov 2009 17:57:39 +0100 Original-Received: from localhost ([127.0.0.1]:54801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBAKA-0004sv-JQ for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Nov 2009 11:57:38 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:QeMQgMAwbGgFdVyB3wxRiro2i34= Original-Lines: 33 Original-NNTP-Posting-Date: 19 Nov 2009 17:17:22 CET Original-NNTP-Posting-Host: bb3b2b34.newsspool2.arcor-online.net Original-X-Trace: DXC=eje; mgfI@jTaAeROF2PWMQA9EHlD; 3YcR4Fo<]lROoRQ8kF5MOK` List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69933 Archived-At: tomas@tuxteam.de writes: > On Thu, Nov 19, 2009 at 12:39:33PM +0100, David Kastrup wrote: >> tomas@tuxteam.de writes: >> >> > Hi, >> > >> > In Elisp, I'm trying to test whether a string is a prefix of another. > > [...] > >> > (when (eq (compare-strings foo 0 5 bar 0 5) t) >> > ...) >> > >> > which looks rather funny. My question: are there better idioms? Am I >> > barking up the wrong function? >> >> (unless (numberp ... >> >> or >> >> (if (symbolp ... > > Thanks. Still looks a bit funna, though :-) In my opinion, t was the wrong choice for a match. nil would have been much better because you can't use the result of compare-strings as a condition. But I suppose there is not much one can do now because of compatibility. -- David Kastrup