書き初め
schemeの感覚で書くとこんな感じかもしれない。foldの代わりにreduceで
(defun dirs-children (dirs &optional exclude) (let ((exclude* (or exclude (mapconcat 'identity '("\\.\\{1,2\\}$" "\\.git$" "\\.svn$") "\\|")))) (nreverse (reduce #'(lambda (acc file) (cond ((and exclude* (string-match exclude* file)) acc) ((file-directory-p file) (let ((children (directory-files file t))) (cons* (dirs-children children exclude*) acc))) (t (cons file acc)))) dirs :initial-value nil)))) (defun cons* (xs ys) (reduce #'(lambda (acc x) (cons x acc)) xs :initial-value ys))