add symbol=? function
This commit is contained in:
parent
71a532eebf
commit
249061982f
|
@ -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 |
|
||||
|
|
|
@ -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)))
|
||||
|
|
Loading…
Reference in New Issue