From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.devel Subject: Re: when and unless Date: Wed, 07 Dec 2011 15:27:17 +0100 Organization: Organization?!? Message-ID: <8739cwihiy.fsf@fencepost.gnu.org> References: <878vsjd2fh.fsf@pobox.com> <87r50ircng.fsf@pobox.com> <87d3c1lq6i.fsf@gnu.org> <87ehwg5ur5.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1323268065 25213 80.91.229.12 (7 Dec 2011 14:27:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 7 Dec 2011 14:27:45 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Dec 07 15:27:41 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RYITE-0007eQ-0S for guile-devel@m.gmane.org; Wed, 07 Dec 2011 15:27:40 +0100 Original-Received: from localhost ([::1]:32844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYITD-0004sK-Ig for guile-devel@m.gmane.org; Wed, 07 Dec 2011 09:27:39 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:49545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYIT7-0004s4-FL for guile-devel@gnu.org; Wed, 07 Dec 2011 09:27:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYIT5-0008T2-KQ for guile-devel@gnu.org; Wed, 07 Dec 2011 09:27:33 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:35533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYIT5-0008Sw-EA for guile-devel@gnu.org; Wed, 07 Dec 2011 09:27:31 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RYIT3-0007ZH-GM for guile-devel@gnu.org; Wed, 07 Dec 2011 15:27:29 +0100 Original-Received: from p508eaf98.dip.t-dialin.net ([80.142.175.152]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 07 Dec 2011 15:27:29 +0100 Original-Received: from dak by p508eaf98.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 07 Dec 2011 15:27:29 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: p508eaf98.dip.t-dialin.net 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.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) Cancel-Lock: sha1:M6IvSEQO68mg3Xd5EB+3y13YYKc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:13005 Archived-At: ludo@gnu.org (Ludovic Courtès) writes: > ludo@gnu.org (Ludovic Courtès) skribis: > >> Andy Wingo skribis: >> >>> On Thu 30 Jun 2011 12:44, Andy Wingo writes: >>> >>>> I think we should add `when' and `unless' to the default environment. >>>> >>>> They go like this: >>>> >>>> (define-syntax when >>>> (syntax-rules () >>>> ((_ test then then* ...) >>>> (if test (begin then then* ... (if #f #f)))))) >>>> >>>> (define-syntax unless >>>> (syntax-rules () >>>> ((_ test else else* ...) >>>> (if (not test) (begin else else* ... (if #f #f)))))) >>> >>> WDYT? `unless' is nice for assertions, `when' is its converse, and most >>> Schemes have them. I would like to add them to Guile too. >> >> Yes, feel free. > > Like Marijn, it seems more natural for me to return the values of the > body’s last expression, rather than *unspecified*. Can you explain how that would even make sense? You can't return a specified value when the condition is not true since then no form gets evaluated. So where is the point in returning a value that is only sometimes specified? "Sometimes specified" logically is pretty much the same as "unspecified", and then we might return *unspecified* right away. -- David Kastrup