add symbol=? function

This commit is contained in:
Yuichi Nishiwaki 2013-11-14 16:52:10 +09:00
parent 71a532eebf
commit 249061982f
2 changed files with 17 additions and 1 deletions

View File

@ -67,7 +67,7 @@
| 6.2.7 Numerical input and output | no | |
| 6.3 Booleans | yes | |
| 6.4 Pairs and lists | yes | |
| 6.5 Symbols | incomplete | TODO: `symbol=?`, `symbol->string`, `string->symbol` |
| 6.5 Symbols | yes | |
| 6.6 Characters | incomplete | TODO: almost all functions in the section :-( |
| 6.7 Strings | incomplete | |
| 6.8 Vectors | incomplete | TODO: `vector-copy`, ...etc |

View File

@ -254,3 +254,19 @@
#f)))
(or (every (lambda (x) (eq? x #t)) objs)
(every (lambda (x) (eq? x #f)) objs)))
(define (symbol=? . objs)
(define (every pred list)
(if (null? list)
#t
(if (pred (car list))
(every pred (cdr list))
#f)))
(let ((sym (car objs)))
(if (symbol? sym)
(every (lambda (x)
(and (symbol? x)
(eq? x sym)))
(cdr objs))
#f)))