[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Writing a procedure in different style
From: |
tomas |
Subject: |
Re: Writing a procedure in different style |
Date: |
Sun, 13 Dec 2020 15:24:12 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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
signature.asc
Description: Digital signature
- Writing a procedure in different style, Zelphir Kaltstahl, 2020/12/12
- Re: Writing a procedure in different style, Taylan Kammer, 2020/12/13
- Re: Writing a procedure in different style, Taylan Kammer, 2020/12/13
- Re: Writing a procedure in different style, Zelphir Kaltstahl, 2020/12/13
- Re: Writing a procedure in different style,
tomas <=
- Re: Writing a procedure in different style, Zelphir Kaltstahl, 2020/12/13
- Re: Writing a procedure in different style, tomas, 2020/12/13
- Re: Writing a procedure in different style, Zelphir Kaltstahl, 2020/12/20
- Re: Writing a procedure in different style, tomas, 2020/12/21
- Re: Writing a procedure in different style, Zelphir Kaltstahl, 2020/12/21