|
From: | Paul Sika |
Subject: | Re: [Chicken-users] list of more than 2 elements is pair? |
Date: | Mon, 10 Dec 2018 12:48:06 +0000 |
* Paul Sika <address@hidden> [181210 13:27]:
> hi Thomas,
> thank you very much. it is indeed clear from your explanation. it is about
> the cons cells.
>
> But i must say that at the back of the mind it feels like it should not
> satisfy pair? because there are 3 elements in the list.
Well, it satisfies pair? since the first cell *is* a pair. The cdr
of the pair just points to another pair...
pair? makes a nice check for recursive procedures as the empty list
is not a pair: (pair? '()) -> #f
This avoids checking for list? and null?
--
May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease.
[Prev in Thread] | Current Thread | [Next in Thread] |