0

I'm just starting to learn common lisp. I do not understand well about lists' structure when I'm reading the Set and Tree chapter. Now I wonder what's exactly it like in the list. I know the cons include two values which can be any types of object. Here I found a picture by google. But I'm very confused. It seems like general lists in data structure. lists in lisp

Yorke
  • 33
  • 4
  • and what exactly is your question? i'm very confused. it seems like general blog entry. – rsm Feb 28 '17 at 03:12
  • sorry,my question may not clear, because my english is porr. Umm, Iwant to know how list is origanized in lisp? – Yorke Feb 28 '17 at 03:43
  • can you please edit your question to include the question? – rsm Feb 28 '17 at 04:03
  • This question is probably too broad, but I think that the answer to [dot notation in Scheme](http://stackoverflow.com/questions/20216711/dot-notation-in-scheme) may be helpful. – Joshua Taylor Feb 28 '17 at 14:24

1 Answers1

0

lists are build using cons cells you mentioned. single cons cell with nil in second part is the simplest list:

(cons 'A nil)
=> (A)

if you want to extend list, you cons another cell to it:

(cons 'C (cons 'B (cons 'A nil)))
=> (C B A)

so list is a series of linked together cons cells.

also, to make life easier there is list function. this way you don't have to write all those cons invocations and can create list like this:

(list 'C 'B 'A)
=> (C B A)

but inside it's still series of cons cells.

rsm
  • 2,530
  • 4
  • 26
  • 33