newLISP Fan Club

Forum => Anything else we might add? => Topic started by: TedWalther on December 26, 2013, 03:02:51 PM

Title: Fix code example in CodePatterns
Post by: TedWalther on December 26, 2013, 03:02:51 PM

; walks a disk directory and prints all path-file names
;
(define (show-tree dir)
    (if (directory dir)


I'm pretty sure (directory dir) above is supposed to be (directory? dir)



http://www.newlisp.org/CodePatterns.html#toc-5



Both versions work, but I think (directory) is more likely to throw an error or fail.
Title: Re: Fix code example in CodePatterns
Post by: Lutz on December 26, 2013, 03:24:56 PM
yes, and (directory? dir) will also be a lot faster, as it doesn't have to collect files but simply checks the file property bits.