From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: TomSW Newsgroups: gmane.emacs.help Subject: Re: Partition for Emacs Lisp Date: Sun, 28 Jun 2009 13:46:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <40fc0b03-f82a-479a-9e4e-22ad1ac8cf17@f19g2000yqo.googlegroups.com> References: <87prcouty9.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1246251786 9657 80.91.229.12 (29 Jun 2009 05:03:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Jun 2009 05:03:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 29 07:02:54 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 1ML914-0005Sp-0j for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Jun 2009 07:02:54 +0200 Original-Received: from localhost ([127.0.0.1]:33893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ML913-0005FF-HY for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Jun 2009 01:02:53 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!f19g2000yqo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-NNTP-Posting-Host: 84.193.193.55 Original-X-Trace: posting.google.com 1246221970 19639 127.0.0.1 (28 Jun 2009 20:46:10 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sun, 28 Jun 2009 20:46:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f19g2000yqo.googlegroups.com; posting-host=84.193.193.55; posting-account=gXCEPAoAAACaHNwa63AHlGuSCIcCahgr User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.11) Gecko/2009060308 Ubuntu/9.04 (jaunty) Firefox/3.0.11, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:170403 X-Mailman-Approved-At: Mon, 29 Jun 2009 01:01:19 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor 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:65621 Archived-At: On Jun 28, 10:16=A0pm, Marc Tfardy wrote: > Is there some reason (performance?) to write partition as above > and not as: > > (defun partition (sequence length) > =A0 =A0(cond ((listp sequence) > =A0 =A0 =A0 =A0 =A0 (partition-list sequence length)) > =A0 =A0 =A0 =A0 =A0((stringp sequence) > =A0 =A0 =A0 =A0 =A0 (partition-vector sequence length)) ; emacs lisp stri= ngs are not vectors! > =A0 =A0 =A0 =A0 =A0((vectorp sequence) > =A0 =A0 =A0 =A0 =A0 =A0(partition-vector sequence length)))) etypecase has three advantages over cond. It clearly documents the fact that what you're interested in is the type of the argument, it saves you repeating the name of the argument in every clause - making the type more salient, and it raises an error if the argument isn't one of the types catered for (that's the "e" in etypecase). regards, Tom SW