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: (list) and '(list) Date: Fri, 27 Apr 2007 12:39:00 +0200 Organization: Organization?!? Message-ID: <85k5vygkzf.fsf@lola.goethe.zz> References: <9406124.888091177600624458.JavaMail.www@wwinf4203> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1177673679 19259 80.91.229.12 (27 Apr 2007 11:34:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Apr 2007 11:34:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 27 13:34:37 2007 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 1HhOie-0002fS-Jd for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Apr 2007 13:34:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhOoU-0003je-8j for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Apr 2007 07:40:34 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.germany.com!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool4.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.11 (Gnus v5.11) Emacs/22.0.98 (gnu/linux) Cancel-Lock: sha1:/FXUZVXgyluzqy8Z8d3AR6TyyiQ= Original-Lines: 33 Original-NNTP-Posting-Date: 27 Apr 2007 12:39:00 CEST Original-NNTP-Posting-Host: 9f4dcc65.newsspool2.arcor-online.net Original-X-Trace: DXC=ZJJH^FnZb26D]ncZ]`hZ; 1A9EHlD; 3Yc24Fo<]lROoR18kF5MOK`; S:bhJ<_9AWUe3Jo`=U^fRl`gSgY9 Original-X-Complaints-To: usenet-abuse@arcor.de Original-Xref: shelby.stanford.edu gnu.emacs.help:147669 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:43272 Archived-At: Kai Grossjohann writes: > Perhaps what you want is to write a special form yourself? That > can't be done in a strict sense, but you can use macros to > approximate the effect. > > For example, to reverse the condition of `if' (proof of concept only, > not production code): > > (defmacro ifnot (test no yes) > (if (not test) no yes)) > > Does that help? You are confusing `defmacro' with `defsubst'. What you wrote above will have the effect of _compiling_ to no if the _unevaluated_ first argument is anything but nil, and to yes if it is nil. That is: (ifnot blurb "x" "y") will (at compile time already) be resolved to "x", regardless whether blurb is currently (or at run time) nil. In fact, the _value_ of blurb is _never_ consulted. To compile to "y", use one of the following: (ifnot nil "x" "y") (ifnot () "x" "y") What will _not_ work is (ifnot '() "x" "y") Because then test will be set to (quote nil) when the test is done, which is not nil, even though it evaluates to nil. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum