History

add null? predicate

Sigrid Haflínudóttir committed 6 years ago

Commit 826176d1 parent b31989b3 files · +5 −0Browse files

Unified · Split

3 files
  1. README.md +1 −0
  2. aa.c +1 −0
  3. test.scm +3 −0
README.md+1−0
@@ -54,6 +54,7 @@ boolean? · 53 unmodified lines
5454 defined?
5555 eq?
5656 nan?
57+null?
5758 number?
5859 string?
5960 ```
aa.c+1−0
@@ -133,6 +133,7 @@ static aaObject rparen; · 132 unmodified lines
133133 static char prelude[] = "\
134134 (define newline (lambda () (display \"\\n\")))\
135135 (define square (lambda (x) (* x x)))\
136+(define null? (lambda (x) (eq? x ())))\
136137 ";
137138
138139 static aaObject *eval(aaContext *ctx, aaObject *obj, aaObject *env, aaObject **bind);
test.scm+3−0
@@ -29,3 +29,6 @@ · 28 unmodified lines
2929 (test '(and #t #t) #t)
3030 (test '(and #f #t) #f)
3131 (test '(and #t #f) #f)
32+(test '(null? ()) #t)
33+(test '(null? #f) #f)
34+(test '(null? (list () ())) #f)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t