From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: if vs. when vs. and: style question Date: Tue, 24 Mar 2015 03:28:39 +0100 Organization: Aioe.org NNTP Server Message-ID: <87wq27yvqg.fsf@debian.uxu> References: <87sicvwckx.fsf@wmi.amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1427163921 3432 80.91.229.3 (24 Mar 2015 02:25:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Mar 2015 02:25:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 24 03:25:21 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YaEWu-0008Dw-AP for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Mar 2015 03:25:20 +0100 Original-Received: from localhost ([::1]:58809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaEWt-0006Ub-7z for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Mar 2015 22:25:19 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 42 Original-NNTP-Posting-Host: feB02bRejf23rfBm51Mt7Q.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:B8czztLgXE3dTtF+YIH2wNncXgI= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:210998 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103279 Archived-At: "Pascal J. Bourguignon" writes: > In general, WHEN is better than IF. > > Also, (unless (e1) (e2)) is better than (if (not (e1)) > (e2)). > > Notably, WHEN and UNLESS have an implicit progn: "In general", you say. Is there any other advantage save for not having to do the explicit `progn' and/or `not'? For almost no one is LISP the first language learned. By the time most people stumble upon LISP they have already written on zillions of if clauses. So I think `if' is clearer and the explicit `progn' and `not' doesn't bother me, but both (all) ways are good. > So you can typically have functions such as: > > (defun find-thingy (name) (or > (find-thingy-in-whatcha name) (find-thingy-in-macall > name) (find-thingy-in-it name) (error "not found"))) > > which is much more concise and clear than ... But is it clearer than (defun look-here () "here") (cond ((look-here)) ((look-there)) (t (message "Not found"))) as well? I always thought of `cond' and `if' as identical save for syntax. -- underground experts united