From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...))) Date: Wed, 05 Jan 2011 04:21:55 +0100 Message-ID: <87tyhot4q4.fsf@ambire.localdomain> References: <877hengesr.fsf@ambire.localdomain> <87tyhoa67u.fsf@ambire.localdomain> <878vz0i06n.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1294198042 16473 80.91.229.12 (5 Jan 2011 03:27:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 5 Jan 2011 03:27:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 05 04:27:18 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PaK1t-0000wy-IL for ged-emacs-devel@m.gmane.org; Wed, 05 Jan 2011 04:27:17 +0100 Original-Received: from localhost ([127.0.0.1]:40574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaK1s-0004XD-7u for ged-emacs-devel@m.gmane.org; Tue, 04 Jan 2011 22:27:16 -0500 Original-Received: from [140.186.70.92] (port=36546 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaK1n-0004Wx-8y for emacs-devel@gnu.org; Tue, 04 Jan 2011 22:27:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PaK1l-0003rT-Qw for emacs-devel@gnu.org; Tue, 04 Jan 2011 22:27:11 -0500 Original-Received: from smtp204.alice.it ([82.57.200.100]:54629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PaK1l-0003qu-IB for emacs-devel@gnu.org; Tue, 04 Jan 2011 22:27:09 -0500 Original-Received: from ambire.localdomain (95.244.66.212) by smtp204.alice.it (8.5.124.08) id 4C88E33B096BDDB0 for emacs-devel@gnu.org; Wed, 5 Jan 2011 04:27:07 +0100 Original-Received: from ttn by ambire.localdomain with local (Exim 4.69) (envelope-from ) id 1PaJwh-0007jV-ND for emacs-devel@gnu.org; Wed, 05 Jan 2011 04:21:55 +0100 In-Reply-To: <878vz0i06n.fsf@uwakimon.sk.tsukuba.ac.jp> (Stephen J. Turnbull's message of "Wed, 05 Jan 2011 10:55:28 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:134271 Archived-At: () "Stephen J. Turnbull" () Wed, 05 Jan 2011 10:55:28 +0900 All these occur in a top-level form, though. Usually, yes. > - Functional style is not unlispy. True, but in the examples so far you could define a macro like (defmacro applificating-cond (&rest clauses) ...) and write (applificating-cond=20 ((cdr list) #'car) ((car list) #'car) No? Yes, but now traditional =E2=80=98cond=E2=80=99 clauses cannot be used with= in =E2=80=98applificating-cond=E2=80=99. The =E2=80=98=3D>=E2=80=99 serves to= distinguish between those clauses requiring the EXPR value and those that don't. Which brings us to: So, do you ever want to write (cond=20 ((cdr list) =3D> #'car) ((car list) (random-expr-not-needing-value-of-car-list free-var)) or the like? (That makes me feel a little ill, but YMMV.) Sure, why not? Good fences make good neighbors, and the price of this flexible neighborliness (or neighborly flexibility) is syntax. (cond ((integerp x) =3D> #'-) ; takes value ((not (listp x)) 42) ; traditional ((cdr x) =3D> #'car) ; takes value ((car x) ; takes value, unnecessarily =3D> (lambda (head) (code that ignores ; head oh well life goes on)))) There are other ways to distinguish between these two clause variants, of course. Doodling out loud: - Move special symbol to head of clause. (=3D> EXPR 1-ARY-FUNC) - Use vectors. [EXPR 1-ARY-FUNC] - Use top-level special symbol. =3D> (EXPR 1-ARY-FUNC) - Use top-level symbol more special in some ways, less in others. t (EXPR 1-ARY-FUNC) - Use a number to encode arity. N (EXPR N-ARY-FUNC) I think the last one is too strange, personally, but there it is.