On this page:
pair?
pair
pair-first
pair-second
7.7

1.5 Pairs

 (require rebellion/base/pair) package: rebellion

A pair is a container of two values. Pairs as defined by rebellion/base/pair are distinct from the pair datatype defined by racket/base, and are meant to be a drop-in replacement for them. Changes include:

Note that rebellion/base/pair provides a pair? predicate that conflicts with the one provided by racket/base.

procedure

(pair? v)  boolean?

  v : any/c
A predicate for pairs, as defined by rebellion/base/pair. Mututally exclusive with list?.

Examples:
> (pair? (pair 1 2))

#t

> (list? (pair 1 2))

#f

> (require (only-in racket/base cons))
> (pair? (cons 1 2))

#f

procedure

(pair first second)  pair?

  first : any/c
  second : any/c
Constructs a pair.

procedure

(pair-first p)  any/c

  p : pair?
Returns the first value of p.

procedure

(pair-second p)  any/c

  p : pair?
Returns the second value of p.