-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprepend.robin
45 lines (29 loc) · 1.01 KB
/
prepend.robin
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
41
42
43
44
45
;'<<SPEC'
### `prepend` ###
-> Tests for functionality "Evaluate core Robin Expression"
`prepend` evaluates both of its arguments, then evaluates to a list cell
which contains the first value as its data and the second value as the
continuation of the list.
| (prepend () ())
= (())
| (prepend #t (prepend #f ()))
= (#t #f)
The second argument to `prepend` must be a list.
| (prepend #t #f)
? abort (expected-list #f)
The first argument to `prepend` can be any type, but fewer than or more than
two arguments will produce an abort value.
| (prepend #t)
? abort (illegal-arguments (#t))
| (prepend #f #t #f)
? abort (illegal-arguments (#f #t #f))
Attempting to prepend an `abort` value to a list will produce an
`abort` value.
| (prepend (abort 999) (prepend #f ()))
? abort 999
| (prepend #t (abort 999))
? abort 999
`prepend` is basically equivalent to Scheme's `cons`, except for the
requirement that the second argument be a list.
'<<SPEC'
(require prepend)