View Source Document

equal-p.robin

;'<<SPEC'

### `equal?` ###

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

`equal?` evaluates both of its arguments to arbitrary S-expressions
and compares them for deep equality.

`equal?` works on symbols.

    | (equal?
    |   (literal this-symbol)
    |   (literal this-symbol))
    = #t

    | (equal?
    |   (literal this-symbol)
    |   (literal that-symbol))
    = #f

`equal?` works on lists.

    | (equal? (prepend 1 (prepend 2 (prepend 3 ())))
    |         (prepend 1 (prepend 2 (prepend 3 ()))))
    = #t

`equal?` works on lists, deeply.

    | (equal? (prepend 1 (prepend 2 (prepend 7 ())))
    |         (prepend 1 (prepend 2 (prepend 3 ()))))
    = #f

Two values of different types are never equal.

    | (equal? #t (prepend (literal a) ()))
    = #f

    | (equal? #f ())
    = #f

Arguments to `equal?` can be any type, but fewer than or more than
two arguments will produce an abort value.

    | (equal? 7)
    ? abort (illegal-arguments (7))

    | (equal? 7 8 9)
    ? abort (illegal-arguments (7 8 9))

'<<SPEC'

(require equal?)