4digit string recognition
This commit is contained in:
parent
669c17123b
commit
69eed25e80
1 changed files with 18 additions and 1 deletions
|
@ -38,6 +38,7 @@
|
||||||
(chicken file posix)
|
(chicken file posix)
|
||||||
(chicken file)
|
(chicken file)
|
||||||
(chicken format)
|
(chicken format)
|
||||||
|
(chicken irregex)
|
||||||
testing
|
testing
|
||||||
utils
|
utils
|
||||||
dictionary)
|
dictionary)
|
||||||
|
@ -95,9 +96,22 @@
|
||||||
name))
|
name))
|
||||||
(+ errs 1))))))))
|
(+ errs 1))))))))
|
||||||
|
|
||||||
|
;; Checks whether given string is a 4-digit decimal number.
|
||||||
|
(define (is-4digit-string? s)
|
||||||
|
(if (irregex-search (irregex "^[0-9]{4}$") s)
|
||||||
|
#t
|
||||||
|
#f))
|
||||||
|
|
||||||
|
;; Returns dictionary containing only records with either 4-digit
|
||||||
|
;; name or one of its aliases being 4-digit.
|
||||||
|
(define (files-dictionary-filter-4digit d)
|
||||||
|
d)
|
||||||
|
|
||||||
(define (load-members dn)
|
(define (load-members dn)
|
||||||
;; get the directory contents
|
;; get the directory contents
|
||||||
(print (files+symlinks->files-dictionary (get-files+symlinks dn)))
|
(let ((fss (files+symlinks->files-dictionary
|
||||||
|
(get-files+symlinks dn))))
|
||||||
|
(print (map length fss)))
|
||||||
;; filter all ids
|
;; filter all ids
|
||||||
;; resolve links (it might be unknown!)
|
;; resolve links (it might be unknown!)
|
||||||
;; load member files
|
;; load member files
|
||||||
|
@ -117,6 +131,9 @@
|
||||||
(666 . nonexistent)))
|
(666 . nonexistent)))
|
||||||
'((nonexistent error-0 666)
|
'((nonexistent error-0 666)
|
||||||
(joe 2803)))
|
(joe 2803)))
|
||||||
|
(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? "666"))
|
||||||
))
|
))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue