git @ Cat's Eye Technologies Robin / master stdlib / boolean-p.robin
master

Tree @master (Download .tar.gz)

boolean-p.robin @masterraw · history · blame

;'<<SPEC'

<!--
Copyright (c) 2012-2024, Chris Pressey, Cat's Eye Technologies.
This file is distributed under a 2-clause BSD license.  See LICENSES/ dir.
SPDX-License-Identifier: LicenseRef-BSD-2-Clause-X-Robin
-->

### `boolean?` ###

    -> Tests for functionality "Evaluate Robin Expression (with Boolean)"

`boolean?` evaluates its argument, then evaluates to `#t` if it is a
boolean value, `#f` otherwise.

    | (boolean? #t)
    = #t

    | (boolean? (head (prepend #f ())))
    = #t

    | (boolean? ())
    = #f

The argument to `boolean?` may (naturally) be any type, but there must be
exactly one argument.

    | (boolean? #t #f)
    ? abort (illegal-arguments

    | (boolean?)
    ? abort (illegal-arguments

'<<SPEC'

(define boolean? (fun (b)
  (if (equal? b #t)
    #t
    (if (equal? b #f)
      #t
      #f))))