|
From: | Paul Sika |
Subject: | Re: [Chicken-users] list of more than 2 elements is pair? |
Date: | Mon, 10 Dec 2018 12:13:21 +0000 |
On Mon, 10 Dec 2018 11:48:56 +0000 Paul Sika <address@hidden> wrote:
> [...]
> I am trying a scheme tutorial using the chicken repl and i see that
> (pair? '(1 2 3)) yields true.
> is this normal ?
> [...]
Hello Paul,
yes, this is perfectly normal: Every non-empty list satisfies the pair?
predicate because lists are linked chains of cons cells.
The _expression_
'(1 2 3)
can also be represented by the the following more verbose notation,
which matches its in-memory structure more closely:
'(1 . (2 . (3 . ())))
Everything represented by '(X . Y) or produced by (cons X Y) will
satisfy pair?.
I hope this helps :-)
Ciao,
Thomas
--
When C++ is your hammer, every problem looks like your thumb.
[Prev in Thread] | Current Thread | [Next in Thread] |