;'<<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
-->
### `abs` ###
-> Tests for functionality "Evaluate Robin Expression (with Arith)"
`abs` evaluates its single argument to a number, and evaluates to
the absolute value of that number (where the sign is always positive.)
| (abs 5)
= 5
| (abs (subtract 0 5))
= 5
| (abs 0)
= 0
`abs` expects exactly one numeric argument.
| (abs)
? abort (illegal-arguments
| (abs 14 23)
? abort (illegal-arguments
| (abs #t)
? abort (expected-number #t)
'<<SPEC'
(define abs (fun (a)
(if (equal? (sign a) 1) a (subtract 0 a))))