Lists of symbols - 4-digit checking.
This commit is contained in:
parent
69eed25e80
commit
0e5b59cab0
1 changed files with 19 additions and 1 deletions
|
@ -102,9 +102,23 @@
|
||||||
#t
|
#t
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
|
;; checks whether given symbol is a 4-digit one.
|
||||||
|
(define (is-4digit-symbol? s)
|
||||||
|
(is-4digit-string?
|
||||||
|
(symbol->string s)))
|
||||||
|
|
||||||
|
;; Returns true if the list contains at least one 4-digit symbol.
|
||||||
|
(define (list-contains-4digit-symbol? lst)
|
||||||
|
(let loop ((lst lst))
|
||||||
|
(if (null? lst)
|
||||||
|
#f
|
||||||
|
(if (is-4digit-symbol? (car lst))
|
||||||
|
#t
|
||||||
|
(loop (cdr lst))))))
|
||||||
|
|
||||||
;; Returns dictionary containing only records with either 4-digit
|
;; Returns dictionary containing only records with either 4-digit
|
||||||
;; name or one of its aliases being 4-digit.
|
;; name or one of its aliases being 4-digit.
|
||||||
(define (files-dictionary-filter-4digit d)
|
(define (files-dictionary-filter-4digit-symbols d)
|
||||||
d)
|
d)
|
||||||
|
|
||||||
(define (load-members dn)
|
(define (load-members dn)
|
||||||
|
@ -134,6 +148,10 @@
|
||||||
(test-true is-4digit-string? (is-4digit-string? "0000"))
|
(test-true is-4digit-string? (is-4digit-string? "0000"))
|
||||||
(test-false is-4digit-string? (is-4digit-string? "AAAA"))
|
(test-false is-4digit-string? (is-4digit-string? "AAAA"))
|
||||||
(test-false is-4digit-string? (is-4digit-string? "666"))
|
(test-false is-4digit-string? (is-4digit-string? "666"))
|
||||||
|
(test-true is-4digit-symbol? (is-4digit-symbol? '|0000|))
|
||||||
|
(test-false is-4digit-symbol? (is-4digit-symbol? '|ABC|))
|
||||||
|
(test-true list-contains-4digit-symbol? (list-contains-4digit-symbol? '(|0000| abc |666|)))
|
||||||
|
(test-false list-contains-4digit-symbol? (list-contains-4digit-symbol? '(|00000| abc |666|)))
|
||||||
))
|
))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue