unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: guile-user@gnu.org
Subject: Re: Writing a procedure in different style
Date: Sun, 13 Dec 2020 15:24:12 +0100	[thread overview]
Message-ID: <20201213142412.GB6620@tuxteam.de> (raw)
In-Reply-To: <33683c10-5e29-8e4a-03a4-64852fbcf474@posteo.de>

[-- Attachment #1: Type: text/plain, Size: 1094 bytes --]

On Sun, Dec 13, 2020 at 01:29:31PM +0100, Zelphir Kaltstahl wrote:
> Hello Taylan!
> 
> I tried your procedure and indeed it seems to work : )
> 
> I think what I had been missing before were 2 things:
> 
> 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/d5275a8390c351ce98fbdc2ad37d210ba63b.pdf

 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2020-12-13 14:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-12 12:22 Writing a procedure in different style Zelphir Kaltstahl
2020-12-13  7:06 ` Taylan Kammer
2020-12-13 11:51   ` Taylan Kammer
2020-12-13 12:29     ` Zelphir Kaltstahl
2020-12-13 14:24       ` tomas [this message]
2020-12-13 15:01         ` Zelphir Kaltstahl
2020-12-13 15:43           ` tomas
2020-12-20 17:57             ` Zelphir Kaltstahl
2020-12-21 12:31               ` tomas
2020-12-21 21:29                 ` Zelphir Kaltstahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201213142412.GB6620@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).