Skip to main content
1 of 3
Dan
  • 33.4k
  • 7
  • 106
  • 171

Convert 2-item list to a dotted pair?

Q: how can I convert a 2-item list to a dotted pair cons cell?

I can convert a 2-item list to a dotted pair with:

(let ((list '(1 2)))
  (cons (car list) (cadr list)))        ; => (1 . 2)

I'm blanking: is there a built-in function that does this, or should I role my own?

Dan
  • 33.4k
  • 7
  • 106
  • 171