Fork me on GitHub
#core-logic
<
2020-03-25
>
niveauverleih22:03:50

Could someone explain the term "list with an improper tail" to me, please? I am trying to understand dotted pairs, lcons and llist, while reading the reasoned schemer.

hiredman22:03:02

in scheme a cons cell is basically a 2 element array

hiredman22:03:18

and you can put anything in either slot

hiredman22:03:02

a list is a cons cell or series of cons cells where the second element (the cdr) is a cons cell or nil

hiredman22:03:50

an improper list is a series of cons cells where the lest cons cell doesn't have nil as the cdr