Fix code example in CodePatterns

For the Compleat Fan
Locked
TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Fix code example in CodePatterns

Post by TedWalther »

Code: Select all

; 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.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Fix code example in CodePatterns

Post by Lutz »

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.

Locked