From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.user Subject: Re: Writing a procedure in different style Date: Sun, 13 Dec 2020 15:24:12 +0100 Message-ID: <20201213142412.GB6620@tuxteam.de> References: <3760549b-b32f-fafc-1291-8e3eda7b3753@posteo.de> <2d6f348c-1e43-a5c4-1998-baa04b91bf8c@gmail.com> <1385bd6a-c14e-76f1-6dfe-4cf50d192375@gmail.com> <33683c10-5e29-8e4a-03a4-64852fbcf474@posteo.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pvezYHf7grwyp3Bc" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23972"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Dec 13 15:24:38 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1koSIg-00067L-AW for guile-user@m.gmane-mx.org; Sun, 13 Dec 2020 15:24:38 +0100 Original-Received: from localhost ([::1]:51634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koSIe-0007lt-8D for guile-user@m.gmane-mx.org; Sun, 13 Dec 2020 09:24:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koSIP-0007lc-HM for guile-user@gnu.org; Sun, 13 Dec 2020 09:24:21 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:52360) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1koSIN-0008Ps-2R for guile-user@gnu.org; Sun, 13 Dec 2020 09:24:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=/u/TJtBk2gOAnB+lQVLoXYwbdVAOwgKcWVMk2S3uoS8=; b=hav6uAcJISjjv29Np/x41wPnYGx6bqaj542ERkQM6cg8e0Oq/5+M2gu6XLQIArtVv/o4YUn+IxbO5JSp7+Qs5LaqiOYodTwoeTKcZkRXv1XL6wQ5YS5ccfKCezCuqcJ3WXz1My4MKClr6ViTmEIeK+LTK06ZqqcP89aIF2t2YTHMC10gFiqtOmLZhZ8JPYd88hVy1yk5XW/T+bn7hwxcHUdfq82yOwsixa78Y2NOnEJDUQhFhaRPPdFoPg8HVsxDE+eXyYumpWikqxW8pMqAy99H8daR5wjnz5HdlJcV64tCACAb3Ds3VF8whKBK8pkZ0kdF9unjqjgo5Fl6uIu6vQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1koSIG-0002JK-5g for guile-user@gnu.org; Sun, 13 Dec 2020 15:24:12 +0100 Content-Disposition: inline In-Reply-To: <33683c10-5e29-8e4a-03a4-64852fbcf474@posteo.de> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17078 Archived-At: --pvezYHf7grwyp3Bc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 13, 2020 at 01:29:31PM +0100, Zelphir Kaltstahl wrote: > Hello Taylan! >=20 > I tried your procedure and indeed it seems to work : ) >=20 > I think what I had been missing before were 2 things: >=20 > 1. I did not have the (if (null? rest) ...) parts, so I always tried to > directly make a recursive call, perhaps wrapped into a cons, append or "When recurring on a list of atoms, /lat/, ask two questions about it: /(null? lat)/ and *else*. When recurring on a number, /n/, ask two questions about it: /(zero? n)/ and *else*. When recurring on a list of S-expressions, /l/, ask three question about it: /(null? l)/, /(atom? ( car l))/, and *else*." Daniel P. Friedman and Matthias Felleisen: The Little Schemer [1] "First Commandment". Now before this sounds arrogant or something: this is a botch I'd be very likely to do myself. That's perhaps why this book, which at first sight looks so harmless, was for me a joy to read. Cheers [1] https://pdfs.semanticscholar.org/35d0/d5275a8390c351ce98fbdc2ad37d210ba= 63b.pdf - t --pvezYHf7grwyp3Bc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl/WJAwACgkQBcgs9XrR2kYpqgCfR6ScguqLDSlRFB6beCWgri/Y ktQAnRB/GQG8ujIBR7oODRGjd2fqWrhd =dEZ1 -----END PGP SIGNATURE----- --pvezYHf7grwyp3Bc--