-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsubtract.robin
More file actions
40 lines (25 loc) · 826 Bytes
/
subtract.robin
File metadata and controls
40 lines (25 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
;'<<SPEC'
### `subtract` ###
-> Tests for functionality "Evaluate core Robin Expression"
`subtract` evaluates its first argument to a number, then
evaluates its second argument to a number, then evaluates
to the difference between the first and second numbers.
| (subtract 6 4)
= 2
| (subtract 1000 8000)
= -7000
Addition may be accomplished by negating the second argument.
| (subtract 999 (subtract 0 999))
= 1998
`subtract` expects both of its arguments to be numbers.
| (subtract #f 100)
? abort (expected-number #f)
| (subtract 100 ())
? abort (expected-number ())
`subtract` expects exactly two arguments.
| (subtract 100 200 300)
? abort (illegal-arguments (100 200 300))
| (subtract)
? abort (illegal-arguments ())
'<<SPEC'
(require subtract)