cons

Category: Pair procedures

Documentation

;;; (cons val1 val2) -> pair?
;;;   val1 : any?
;;;   val2 : any?
;;; Create a pair from `val1` and `val2`.
;;;;
;;; Note: Non-list pairs are shown with a period between the values.

Examples

> (cons 1 2)
'(1 . 2)
> (cons "x" "y")
'("x" . "y")
> (pair? (cons 1 2))
#t

Tests

Forthcoming.

See also

car, cdr, cons (for pairs),

Questions

Why don’t you have an implementation of cons?

cons is a primitive procedure. It’s (nearly) impossible to implement it in terms of more basic operations.