Walk a directory/Recursively: Difference between revisions

Content added Content deleted
(→‎{{header|C}}: added C++)
(add CL)
Line 138:
return 0;
}</lang>
 
=={{header|Common Lisp}}==
 
{{libheader|CL-FAD}}
 
This example uses the <code>CL-FAD</code> library to achieve compatibility where the ANSI CL standard leaves ambiguities about pathnames.
 
<lang lisp>(defun mapc-directory-tree (fn directory)
(dolist (entry (cl-fad:list-directory directory))
(when (cl-fad:directory-pathname-p entry)
(mapc-directory-tree fn entry))
(funcall fn entry)))</lang>
 
<lang lisp>CL-USER> (mapc-directory-tree (lambda (x)
(when (equal (pathname-type x) "lisp")
(write-line (namestring x))))
"lang/lisp")
/home/sthalik/lang/lisp/.#bitmap.lisp
/home/sthalik/lang/lisp/avg.lisp
/home/sthalik/lang/lisp/bitmap.lisp
/home/sthalik/lang/lisp/box-muller.lisp
/home/sthalik/lang/lisp/displaced-subseq.lisp
[...]</lang>
 
=={{header|C++}}==