Are pair and list different in Scheme?

Thomson picture Thomson · May 15, 2011 · Viewed 9k times · Source

I wonder whether '(1 . 2) and '(1 2) mean the same data (equal to each other) in Scheme or not? I think they are the same thing, is this correct?

Answer

hammar picture hammar · May 15, 2011

No, they are not the same.

'(1 . 2) means (cons 1 2)

whereas

'(1 2) means (cons 1 (cons 2 nil))