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. That said, I shall keep learning :-) thanks again, Thomas. On Mon, Dec 10, 2018 at 12:00 PM Thomas Chust <[email protected]> wrote: > On Mon, 10 Dec 2018 11:48:56 +0000 Paul Sika <[email protected]> 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. >
_______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
