Skip to main content
3 of 3
spelling fix
Wilfred Hughes
  • 7k
  • 2
  • 33
  • 60

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 roll my own?

Dan
  • 33.4k
  • 7
  • 106
  • 171