82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
(patts-b (map (lambda (x)
(let ((newpatt (conc test-a "/" (substring x test-b-len (string-length x)))))
;; (print "in map, x=" x ", newpatt=" newpatt)
newpatt))
(filter (lambda (x)
(eq? (substring-index (conc test-b "/") x) 0))
patts))))
(string-intersperse (delete-duplicates (append patts patts-b)) ",")))
;; tests:glob-like-match
(define (tests:glob-like-match patt str)
(let ((like (substring-index "%" patt)))
(let* ((notpatt (equal? (substring-index "~" patt) 0))
(newpatt (if notpatt (substring patt 1) patt))
(finpatt (if like
(string-substitute (regexp "%") ".*" newpatt #f)
|
|
>
>
>
|
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
(patts-b (map (lambda (x)
(let ((newpatt (conc test-a "/" (substring x test-b-len (string-length x)))))
;; (print "in map, x=" x ", newpatt=" newpatt)
newpatt))
(filter (lambda (x)
(eq? (substring-index (conc test-b "/") x) 0))
patts))))
(string-intersperse (delete-duplicates (append patts (if (null? patts-b)
(list (conc test-a "/%"))
patts-b)))
",")))
;; tests:glob-like-match
(define (tests:glob-like-match patt str)
(let ((like (substring-index "%" patt)))
(let* ((notpatt (equal? (substring-index "~" patt) 0))
(newpatt (if notpatt (substring patt 1) patt))
(finpatt (if like
(string-substitute (regexp "%") ".*" newpatt #f)
|