[plt-scheme] for-each being skipped

From: Andrey Skylar (skyarland at gmail.com)
Date: Wed Jul 13 10:48:41 EDT 2005

On 7/13/05, Will Farr <wmfarr at gmail.com> wrote:
> Andrey,
> In your example, you're missing a parenthesis which would close the
> lambda expression:
> (define (func dir)
>   (let ([list-of-dirs (filter directory-exists? (directory-list dir))]
>     (for-each (lambda (val) (create-file-get-string val)) list-of-dirs)
>     (create-file-get-string dir)))
> I don't know if that's really the problem (maybe you just keyed it in
> incorrectly).

Thanks a lot guys.  The problem was that I was filtering using
directory-exists? on the valuesa returned by directory-list.  I needed
to append those values onto my base path in order for this to work. 
So my filter should have looked like this:

(filter (lambda (d) (directory-exists? (build-path dir d)))
(directory-list dir))

Also, I the example I provided was entered directly in my email (not
copy paste from source).  Sorry about the parenthesis confusion, I'll
make sure not to leave any stray from now on.


Posted on the users mailing list.