-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathenv.robin
More file actions
35 lines (28 loc) · 1.26 KB
/
env.robin
File metadata and controls
35 lines (28 loc) · 1.26 KB
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
;'<<SPEC'
-> Tests for functionality "Evaluate Robin Expression (with Small)"
`env` evaluates to all the bindings in effect at the point of execution
where this form is encountered, as an alist.
| (bind lookup-r
| (fexpr (args env)
| (bind self (eval env (head args))
| (bind target (eval env (head (tail args)))
| (bind items (eval env (head (tail (tail args))))
| (if (equal? items ()) ()
| (if (equal? (head (head items)) target) (tail (head items))
| (self self target (tail items))))))))
| (lookup-r lookup-r (literal symbol?) (env)))
= (symbol?)
`env` expects no arguments. Any arguments supplied will be simply ignored
and discarded, without being evaluated.
| (bind lookup-r
| (fexpr (args env)
| (bind self (eval env (head args))
| (bind target (eval env (head (tail args)))
| (bind items (eval env (head (tail (tail args))))
| (if (equal? items ()) ()
| (if (equal? (head (head items)) target) (tail (head items))
| (self self target (tail items))))))))
| (lookup-r lookup-r (literal symbol?) (env (goofah whatever))))
= (symbol?)
'<<SPEC'
(define env (fexpr (args env) env))