Lisp – Dotted Pair’s Analogy in Other Implementations

clojurelispscheme

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.

Best Answer

Common Lisp (implementation: SBCL)

* (cons 1 2)

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

1
* (cdr '(1 . 2))

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))
1
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.