>>100602956
>>100603091
If I don't understand something I might break it down like this (might help seeing an interactive repl session)
;; load module containing scandir (found from https://www.gnu.org/software/guile/manual/html_node/Procedure-Index.html)
* (import (ice-9 ftw))
;; scandir's signature
* scandir
#<procedure scandir (name #:optional select? entry<?)>
;; print scandir's docstring
* ,d scandir
Return the list of the names of files contained in directory NAME
that match predicate SELECT? (by default, all files.) The returned list
of file names is sorted according to ENTRY<?, which defaults to
`string-locale<?'. Return #f when NAME is unreadable or is not a
directory.
;; run scandir on current directory
* (scandir ".")
("." ".." "booru" "cache" "doc" "lisp" "micro" "www")
;; run scandir on current directory, using the optional select? parameter
* (scandir "." (lambda (name) (string-contains name "c")))
("cache" "doc" "micro")
;; mapping a function over the previous list
* (map (lambda (x) (string-append x "!")) (scandir ...))
("cache!" "doc!" "micro!")
;; for-each is just map, except it doesn't return a list (if we're using a function just for side effects like loading or printing, we don't need it)
* (for-each (lambda (x) (display x) (newline)) (scandir ...))
cache
doc
micro