add boolean=?

This commit is contained in:
Yuichi Nishiwaki 2013-11-14 14:31:57 +09:00
parent 1fa0308ea8
commit 6296d4bee2
2 changed files with 11 additions and 1 deletions

View File

@ -65,7 +65,7 @@
| 6.2.5 Syntax of numerical constants | yes | |
| 6.2.6 Numerical operations | yes | some functions that return multiple values are not supported for now. Also, picrin does not provide complex library procedures. |
| 6.2.7 Numerical input and output | no | |
| 6.3 Booleans | incomplete | TODO: `boolean=?` |
| 6.3 Booleans | yes | |
| 6.4 Pairs and lists | yes | |
| 6.5 Symbols | incomplete | TODO: `symbol=?`, `symbol->string`, `string->symbol` |
| 6.6 Characters | incomplete | TODO: almost all functions in the section :-( |

View File

@ -244,3 +244,13 @@
(eq? '*values-tag* (car res)))
(apply consumer (cdr res))
(consumer res))))
(define (boolean=? . objs)
(define (every pred list)
(if (null? list)
#t
(if (pred (car list))
(every pred (cdr list))
#f)))
(or (every (lambda (x) (eq? x #t)) objs)
(every (lambda (x) (eq? x #f)) objs)))