Added DIR-STREAM-TOOLS
This commit is contained in:
parent
1d23202be6
commit
c1bfb701b3
|
@ -1,2 +1,3 @@
|
|||
version 0.0
|
||||
version 1.0
|
||||
* New package system.
|
||||
* New structure DIR-STREAM-TOOLS
|
|
@ -169,3 +169,15 @@ file represented by FS-OBJECT.
|
|||
Returns #t if REGEXP-SEARCH? for regexp matches the filename
|
||||
(including the absolute path) of the file represented by FS-OBJECT.
|
||||
|
||||
|
||||
The structure DIR-STREAM-TOOLS offers two small applications of the library:
|
||||
|
||||
(dir-stream-disc-usage dir-stream) -> list
|
||||
|
||||
Returns a list with three elements: the name of the directory, the
|
||||
disc usage in bytes, and a list of the sub-directories in the same
|
||||
format.
|
||||
|
||||
(dir-stream-display dir-stream) -> unspecific
|
||||
|
||||
Displays DIR-STREAM.
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
(define (dir-stream-disc-usage ds)
|
||||
(dir-stream-fold-right ds (lambda (fso sum subdirs)
|
||||
(list (fs-object-file-name fso)
|
||||
(apply + sum (map cadr subdirs))
|
||||
subdirs))
|
||||
(lambda (fso accu)
|
||||
(+ accu (file-info:size (fs-object-info fso))))
|
||||
0
|
||||
cons
|
||||
'()))
|
||||
|
||||
(define (dir-stream-display ds)
|
||||
(dir-stream-for-each ds display display))
|
|
@ -61,6 +61,10 @@
|
|||
stream-take-while
|
||||
stream-drop-while))
|
||||
|
||||
(define-interface dir-stream-tools-interface
|
||||
(export dir-stream-disc-usage
|
||||
dir-stream-display))
|
||||
|
||||
(define-structure dir-streams dir-streams-interface
|
||||
(open scheme-with-scsh
|
||||
handle
|
||||
|
@ -77,6 +81,11 @@
|
|||
dir-streams)
|
||||
(files dir-stream-predicates))
|
||||
|
||||
(define-structure dir-stream-tools dir-stream-tools-interface
|
||||
(open scheme-with-scsh
|
||||
dir-streams)
|
||||
(files dir-stream-tools))
|
||||
|
||||
(define-structure streams
|
||||
streams-interface
|
||||
(open scheme
|
||||
|
|
Loading…
Reference in New Issue