Megatest

Check-in [80a94ea109]
Login
Overview
Comment:Added alt version of multi-glob from Robert.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65
Files: files | file ages | folders
SHA1: 80a94ea109520c8cc719f9f7fb83e78f670a2c06
User & Date: matt on 2019-11-21 18:38:30
Other Links: branch diff | manifest | tags
Context
2019-11-22
09:17
Added test for the path-glob check-in: a7f72a923a user: mrwellan tags: v1.65
2019-11-21
18:38
Added alt version of multi-glob from Robert. check-in: 80a94ea109 user: matt tags: v1.65
09:25
Improved multi-glob check-in: c8e58c2956 user: mrwellan tags: v1.65
Changes

Modified multi-glob.scm from [1e40166643] to [3de22bebd8].

17
18
19
20
21
22
23

















				    (let ((new (string-append curr part)))
				      (cond
				       ((and (directory? curr)(file-read-access? curr))
					(glob new))
				       ((member part '("." ".." "/")) new)
				       (else '()))))
				  result)))))))))
























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
				    (let ((new (string-append curr part)))
				      (cond
				       ((and (directory? curr)(file-read-access? curr))
					(glob new))
				       ((member part '("." ".." "/")) new)
				       (else '()))))
				  result)))))))))

;; alternative implementation

(define (path-glob pattern)
  (let ((parts (string-split pattern "/" '())))
    (if (null? parts)
       '()
       (glob-expand (car parts) (cdr parts))
    )))

(define (glob-expand pattern #!optional (rest '()))
   (let ((result '()) (expanded (glob pattern)))
      (apply append result (cond
        ((null? expanded) (list '()))
        ((null? rest)     (list expanded))
        (else (map (lambda (x) (if (directory? x) (glob-expand (conc x "/" (car rest)) (cdr rest)) '())) expanded))
      ))))