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)
|
||||
(chicken format)
|
||||
(chicken irregex)
|
||||
testing
|
||||
utils
|
||||
dictionary)
|
||||
|
@ -95,9 +96,22 @@
|
|||
name))
|
||||
(+ 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)
|
||||
;; 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
|
||||
;; resolve links (it might be unknown!)
|
||||
;; load member files
|
||||
|
@ -117,6 +131,9 @@
|
|||
(666 . nonexistent)))
|
||||
'((nonexistent error-0 666)
|
||||
(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