-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpredicates.lisp
49 lines (33 loc) · 1 KB
/
predicates.lisp
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
46
47
48
49
(in-package :minerva)
(defun labels-p (x)
(and (listp x) (eql (first x) 'labels)))
(defun lexpr-code-p (x)
(eql (car x) 'code))
(defun funcallp (x)
(and (listp x) (eql (first x) 'funcall)))
(defun tailcallp (x)
(and (listp x) (eql (first x) 'tailcall)))
(defun closurep (x)
(and (listp x) (eql (first x) 'closure)))
(defun lambdap (x)
(and (listp x) (eql (first x) 'lambda)))
(defun quotep (x)
(and (listp x) (eql (first x) 'quote)))
(defun constant-init-p (x)
(and (listp x) (eql (car x) 'constant-init)))
(defun constant-ref-p (x)
(and (listp x) (eql (car x) 'constant-ref)))
(defun if-p (x)
(and (listp x) (eql (first x) 'if)))
(defun immediatep (x)
(or (integerp x) (characterp x) (boolp x) (null x)))
(defun variablep (x)
(and (symbolp x) (not (null x))))
(defun closed-variable-p (x env)
(> (lookup x env) 0))
(defun letp (x)
(and (listp x) (eql (first x) 'let)))
(defun primcallp (x)
(and (listp x) (not (null x))))
(defun set!-p (x)
(and (listp x) (eql (car x) 'set!)))