{"size": 1720, "ext": "scrbl", "max_stars_repo_path": "private/pair.scrbl", "max_stars_repo_name": "dys-bigwig/rebellion", "max_stars_repo_stars_event_min_datetime": "2019-05-28T21:50:27.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T21:21:52.000Z", "max_issues_repo_path": "private/pair.scrbl", "max_issues_repo_name": "dys-bigwig/rebellion", "max_issues_repo_issues_event_min_datetime": "2019-03-02T23:19:07.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-24T08:43:16.000Z", "max_forks_repo_path": "private/pair.scrbl", "max_forks_repo_name": "dys-bigwig/rebellion", "max_forks_repo_forks_event_min_datetime": "2019-02-01T22:21:26.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-24T04:35:35.000Z"}
{"max_stars_count": 73, "max_issues_count": 216, "max_forks_count": 20, "avg_line_length": 33.0769230769, "max_line_length": 82, "alphanum_fraction": 0.6877906977}
#lang scribble/manual

@(require (for-label (except-in racket/base pair?)
                     racket/contract/base
                     rebellion/base/pair)
          (submod rebellion/private/scribble-evaluator-factory doc)
          scribble/example)

@(define make-evaluator
   (make-module-sharing-evaluator-factory
    #:public (list 'rebellion/base/pair)
    #:private (list 'racket/base)))

@title{Pairs}
@defmodule[rebellion/base/pair]

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

@itemlist[
 @item{@racket[cons] is spelled @racket[pair]}
 @item{@racket[car] is spelled @racket[pair-first]}
 @item{@racket[cdr] is spelled @racket[pair-second]}
 @item{@racket[list?] does not imply @racket[pair?]}
 @item{@racket[(pair 1 2)] writes as @literal{(pair 1 2)} instead of
  @literal{(1 . 2)}}]

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

@defproc[(pair? [v any/c]) boolean?]{
 A predicate for @tech{pairs}, as defined by @racketmodname[rebellion/base/pair].
 Mututally exclusive with @racket[list?].

 @(examples
   #:eval (make-evaluator) #:once
   (pair? (pair 1 2))
   (list? (pair 1 2))
   (require (only-in racket/base cons))
   (pair? (cons 1 2)))}

@defproc[(pair [first any/c] [second any/c]) pair?]{
 Constructs a @tech{pair}.}

@defproc[(pair-first [p pair?]) any/c]{
 Returns the first value of @racket[p].}

@defproc[(pair-second [p pair?]) any/c]{
 Returns the second value of @racket[p].}
