What is Scheme's dotted pair construct analogous to in other Lisp implementations? I can make a vector or list quite easily, and understand those in Clojure, even though the syntax is a little different, like Clojure's vectors use square brackets [].

However, seeing a dotted pair for the first time threw me. It almost looks like it is an implementation of of map.

I'm not looking for a discussion, but more for use or the dotted pair equivalent in other Lisp dialects, like Clojure, or even Python.


2 Answers 2


Common Lisp (implementation: SBCL)

* (cons 1 2)

(1 . 2)
* (car '(1 . 2))

* (cdr '(1 . 2))


I'm pretty sure that's standard Common Lisp.

Here's some Clojure:

Clojure 1.3.0
user=> (cons 1 2)
IllegalArgumentException Don't know how to create ISeq from: java.lang.Long  clojure.lang.RT.seqFrom (RT.java:487)
user=> (car '(1 . 2))
CompilerException java.lang.RuntimeException: Unable to resolve symbol: car in this context, compiling:(NO_SOURCE_PATH:2) 
user=> (cdr '(1 . 2))
CompilerException java.lang.RuntimeException: Unable to resolve symbol: cdr in this context, compiling:(NO_SOURCE_PATH:3) 
user=> '(1 . 2)
(1 . 2)
user=> (first '(1 . 2))
user=> (rest '(1 . 2))
(. 2)

I'm really not a Clojure expert (or a Common Lisp expert), but I'm not sure Clojure has anything that supports an improper list (like '(a b . c)) built in.

  • Are you saying that cons is a list pair builder? You're right there's nothing like it I know of in Clojure. Jun 16, 2012 at 10:26
  • In other LISPs (cons) is a list pair builder. It looks from the first error message that (cons) is a Clojure function but doesn't allow arbitrary data as the second argument.
    – user55019
    Jun 16, 2012 at 17:46

There's no dotted pair in Clojure.

A philosophical reason for this is that Clojure avoids the use of a concrete "pair" data structure and instead emphasises abstract "sequences" which can have may possible concrete implementations.

The closest equivalents are list and cons:

;; construct a sequence by consing a value onto any sequential object (here a vector)
(cons 1 [2 3 4])
=> (1 2 3 4)

;; construct a list
(list 1 2 3 4)
=> (1 2 3 4)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.