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

Tree @master (Download .tar.gz)

lte-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
-->

### `lte?` ###

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

`lte?` evaluates both of its arguments to numbers, then evaluates to `#t`
if the first number is less than or equal to the second.

    | (lte? 6 4)
    = #f

    | (lte? 6 8)
    = #t

    | (lte? 6 6)
    = #t

    | (lte? 1610612736 (subtract 0 1610612736)))
    = #f

    | (lte? (subtract 0 1610612736) 1610612736)
    = #t

`lte?` expects exactly two arguments, both numbers.

    | (lte? 14)
    ? abort (illegal-arguments

    | (lte? 14 23 57)
    ? abort (illegal-arguments

    | (lte? 14 #t)
    ? abort (expected-number #t)

    | (lte? #t 51)
    ? abort (expected-number #t)

'<<SPEC'

(define lte? (fun (a b)
  (if (equal? a b) #t (lt? a b))))