From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: What is the best way to navigate #ifdef and #endif in C program Date: Fri, 06 Aug 2010 01:46:26 +0200 Organization: Informatimago Message-ID: <87zkx0vd0t.fsf@kuiper.lan.informatimago.com> References: <53f62f81-fb10-4fb6-87ce-0eb5609d12f5@h17g2000pri.googlegroups.com> <87y6cmsmf1.fsf@kuiper.lan.informatimago.com> <57db02c5-32db-4483-863e-a9177e4e6003@w30g2000yqw.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291859090 8215 80.91.229.12 (9 Dec 2010 01:44:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 01:44: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 Dec 09 02:44:43 2010 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.69) (envelope-from ) id 1PQVYo-0002GL-J5 for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 02:44:42 +0100 Original-Received: from localhost ([127.0.0.1]:46924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQVYo-0002nX-2G for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 20:44:42 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.lang.lisp,comp.lang.scheme Original-Lines: 61 Original-X-Trace: individual.net H6v2ongjvCprN2eUToUd1grUxY4UHQBkNSNLTQxZ+zO75E2Z0c Cancel-Lock: sha1:OGZjNTI4MzRmZjY2YjJmYTMwZTc5ZGFkNTYxMzI5MTcxZmUxYzNjMw== sha1:21wt+TVHqAWwLPd6cNw21cRkSMM= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.2 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:180433 comp.lang.lisp:290963 comp.lang.scheme:87285 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:76407 Archived-At: Peter Keller writes: > In comp.lang.lisp Elena wrote: >> On 4 Ago, 17:09, Peter Keller wrote: >>> Specifically:http://letoverlambda.com/index.cl/guest/chap5.html#sec_4 >>> >>> Would show you how to write a macro such that it adds Scheme's tail call >>> optimized "named let" into Common Lisp. ?This goes beyond the concept >>> of syntactic sugar and enters the domain of pure code transformation. >> >> Indeed, code transformation is what sets CL's macros apart. However, >> TCO is much more than that. Read here: >> >> http://stackoverflow.com/questions/2181852/tail-call-elimination-in-clojure > > After reading that, I assert that I don't know how to take base CL > and make it tail recursive since redefining things like defun and > whatnot lead to package lock errors. Even things like define-compiler-macro > can't redefine any of the CL macros or functions. > > One probably could have success if they created forms like defun-tco, > labels-tco, flet-tco, etc which kept track of their code expansions > and rewrote them to be tco. But at that point you've implemented a > tco enforced lisp dialect on top of CL. It is almost trivial to provide a package (possibly even named "COMMON-LISP") which is like the "COMMON-LISP" package, but that is not the implementation's "COMMON-LISP" package. See for example: http://www.informatimago.com/develop/lisp/small-cl-pgms/ibcl/ The trick is in defining a defpackage form such as: (defmacro defpackage (name &rest options) `(cl:defpackage ,name ,@(mapcar (lambda (option) (if (listp option) (case (first option) ((:use) (substitute "IBCL" "COMMON-LISP" (substitute "IBCL" "CL" option))) ((:shadowing-import-from :import-from) (if (member (string (second option)) '("CL" "COMMON-LISP") :test (function string=)) (list* (first option) "IBCL" (cddr option)) option)) (otherwise option)))) options))) where you substitute the "COMMON-LISP" package for your own. (You also need to define your own reader and loader, but these components are available too). -- __Pascal Bourguignon__ http://www.informatimago.com/