{"size": 988, "ext": "scrbl", "max_stars_repo_path": "private/bit.scrbl", "max_stars_repo_name": "dys-bigwig/rebellion", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "private/bit.scrbl", "max_issues_repo_name": "dys-bigwig/rebellion", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "private/bit.scrbl", "max_forks_repo_name": "dys-bigwig/rebellion", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.0, "max_line_length": 75, "alphanum_fraction": 0.6538461538}
#lang scribble/manual

@(require (for-label racket/base
                     racket/contract/base
                     rebellion/binary/bit)
          (submod rebellion/private/scribble-evaluator-factory doc)
          scribble/example)

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

@title{Bits}
@defmodule[rebellion/binary/bit]

A @deftech{bit} is either zero or one. Eight bits form a @tech{byte}, and a
@tech{bitstring} is an arbitrary-length sequence of bits.

@defproc[(bit? [v any/c]) boolean?]{
 A predicate for @tech{bits}.}

@defproc[(bit->boolean [b bit?]) boolean?]{
 Converts zero to false and one to true.

 @(examples
   #:eval (make-evaluator) #:once
   (bit->boolean 0)
   (bit->boolean 1))}

@defproc[(boolean->bit [bool boolean?]) bit?]{
 Converts true to one and false to zero.

 @(examples
   #:eval (make-evaluator) #:once
   (boolean->bit #t)
   (boolean->bit #f))}
