utils: Add list-contents and almost-basename procedures
parent
9b81802b1a
commit
e21427c872
|
@ -2,9 +2,12 @@
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module (ice-9 ftw)
|
||||||
#:export (associate-left
|
#:export (associate-left
|
||||||
associate-right
|
associate-right
|
||||||
flat-map))
|
flat-map
|
||||||
|
list-contents
|
||||||
|
almost-basename))
|
||||||
|
|
||||||
(define-syntax-rule
|
(define-syntax-rule
|
||||||
(associate-left (key associations) ...)
|
(associate-left (key associations) ...)
|
||||||
|
@ -26,3 +29,13 @@ list, up to the last list."
|
||||||
(lambda arglst (apply proc h arglst))
|
(lambda arglst (apply proc h arglst))
|
||||||
tail-lsts))
|
tail-lsts))
|
||||||
head-lst))))
|
head-lst))))
|
||||||
|
|
||||||
|
(define (list-contents dir)
|
||||||
|
(and=> (scandir dir)
|
||||||
|
(lambda (subdirs)
|
||||||
|
(map (cut string-append dir "/" <>)
|
||||||
|
(cddr subdirs)))))
|
||||||
|
|
||||||
|
(define (almost-basename file)
|
||||||
|
(string-append (basename (dirname file))
|
||||||
|
"/" (basename file)))
|
||||||
|
|
Loading…
Reference in New Issue