[plt-scheme] for-each being skipped

From: Will Farr (wmfarr at gmail.com)
Date: Wed Jul 13 10:08:25 EDT 2005

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).

Will

On 7/13/05, Andrey Skylar <skyarland at gmail.com> wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> I'm writing some code that looks like this:
> 
> (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)))
> 
> where create-file-get-string writes something to a file and then
> returns a string (the file name).
> 
> The for-each statement doesn't seem to get executed when ever I call
> func, but if I do everything out by hand it works.  Why is this
> happening, and what can I do so that scheme doesn't skip the for-each
> statment?
> 
> -Andrey
> 
>



Posted on the users mailing list.