[racket] Newbie question - Drscheme hangs on directory-exists?

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Wed Jul 21 17:56:11 EDT 2010

John Sampson wrote:
> Hello -
> 
> If I enter "(directory-exists? "C:\iconsource")" into DrRacket
> I would expect it to answer with "#t" or "'#f" but in fact the
> cursor goes to the next line, leaving an indent.
> I am running this on Windows 7.
> 
> As a newbie I do not understand this behaviour.

You need to escape the backslash in your string:

   (directory-exists? "C:\\iconsource")

DrRacket colors the bad string red to indicate that there's a problem 
with it. If you insert the extra backslash, it turns green.

Wouldn't it be nice for DrRacket to signal an error when you hit enter 
instead? Yes, but it strikes me as a subtle problem. (We do, after all, 
want to permit multi-line repl entries.) I'll let someone who's thought 
about it more address that part.

Ryan



Posted on the users mailing list.