From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Issac Trotts" Newsgroups: gmane.lisp.guile.user Subject: Re: C++ declaration style programming? Date: Tue, 20 Jan 2004 20:57:35 -0800 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <20040121045735.GB3375@manzanita> References: <16397.43262.881852.180514@localhost.localdomain> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1074661231 6025 80.91.224.253 (21 Jan 2004 05:00:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 21 Jan 2004 05:00:31 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Jan 21 06:00:23 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AjATW-0004Zy-00 for ; Wed, 21 Jan 2004 06:00:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AjASw-0002K0-Qy for guile-user@m.gmane.org; Tue, 20 Jan 2004 23:59:46 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AjASC-0002Dn-C3 for guile-user@gnu.org; Tue, 20 Jan 2004 23:59:00 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AjARe-00024Z-4s for guile-user@gnu.org; Tue, 20 Jan 2004 23:58:57 -0500 Original-Received: from [169.237.105.29] (helo=pop19.ucdavis.edu) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AjARd-000247-Md for guile-user@gnu.org; Tue, 20 Jan 2004 23:58:25 -0500 Original-Received: from scarlet.ucdavis.edu ([128.120.141.214]) by pop19.ucdavis.edu (8.12.10/8.12.9/it-std-5.2.0) with SMTP id i0L4wN4t016505 for ; Tue, 20 Jan 2004 20:58:23 -0800 (PST) Original-Received: by scarlet.ucdavis.edu (sSMTP sendmail emulation); Tue, 20 Jan 2004 20:57:35 -0800 Original-To: guile-user@gnu.org Content-Disposition: inline In-Reply-To: <16397.43262.881852.180514@localhost.localdomain> User-Agent: Mutt/1.5.4i X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2670 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2670 On Tue, Jan 20, 2004 at 11:17:34PM +0100, Han-Wen Nienhuys wrote: > > Hi there, > > I just realized that one of the things that I dislike about Scheme is > that my habit of naming intermediate results (which I inherited from > C++) leads to deep nesting. > > Usually in C++, I do > > int var1 = something (); > int var2 = something (var1); > int var3 = something (var1, var2); > etc. > > in Scheme, this translates quite well to (let* ) : > > (let* > ((var1 (something)) > (var2 (something var1)) > (var3 (something var1 var2))) > .. ) > > However, it doesn't work so well when I mix commands with > declarations, eg. > > > int var1 = something (); > var1 += 2; > int var2 = something (var1); > var2 += var1; > int var3 = something (var1, var2); > etc. Well, in this case you could do something more functional: (define (something . x) 1) (let* ((var1 (+ 2 (something))) (var2 (+ (something var1) var1)) (var3 (something var1 var2))) (display `(,var1 ,var2 ,var3))) > This can presumably be done by writing a macro begin-let* that expands > the statement list in a suitably nested let* > > However, I was wondering whether there exists a standard library > syntax mechanism that lets me write code in this fashion. > > -- > > Han-Wen Nienhuys | hanwen@xs4all.nl | http://www.xs4all.nl/~hanwen > > > > _______________________________________________ > Guile-user mailing list > Guile-user@gnu.org > http://mail.gnu.org/mailman/listinfo/guile-user -- Issac Trotts http://redwood.ucdavis.edu/~issac _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user