Re: [racket] testing impure stuff

2013-12-23 Thread Greg Hendershott
On Sun, Dec 22, 2013 at 2:49 PM, Neil Van Dyke wrote: > Manfred Lotz wrote at 12/22/2013 01:54 PM: >> Or perhaps even better create my directory structure on the fly and >> build my test cases upon this? > Yes, like that. It can be tedious to develop, but then your test suite is > more likely to

Re: [racket] testing impure stuff

2013-12-23 Thread Manfred Lotz
On Mon, 23 Dec 2013 13:53:05 -0500 Greg Hendershott wrote: > On Sun, Dec 22, 2013 at 2:49 PM, Neil Van Dyke > wrote: > > Manfred Lotz wrote at 12/22/2013 01:54 PM: > >> Or perhaps even better create my directory structure on the fly and > >> build my test cases upon this? > > Yes, like that. It

Re: [racket] testing impure stuff

2013-12-23 Thread Matthias Felleisen
On Dec 23, 2013, at 2:10 PM, Manfred Lotz wrote: > On Mon, 23 Dec 2013 13:53:05 -0500 > Greg Hendershott > wrote: > >> On Sun, Dec 22, 2013 at 2:49 PM, Neil Van Dyke >> wrote: >>> Manfred Lotz wrote at 12/22/2013 01:54 PM: Or perhaps even better create my directory structure on the fly

Re: [racket] testing impure stuff

2013-12-23 Thread Manfred Lotz
On Mon, 23 Dec 2013 14:29:31 -0500 Matthias Felleisen wrote: > > > On Dec 23, 2013, at 2:10 PM, Manfred Lotz > wrote: > > > On Mon, 23 Dec 2013 13:53:05 -0500 > > Greg Hendershott > > wrote: > > > >> On Sun, Dec 22, 2013 at 2:49 PM, Neil Van Dyke > >> wrote: > >>> Manfred Lotz wrote at 12/

Re: [racket] testing impure stuff

2013-12-23 Thread Matthias Felleisen
For that, you will need to wrap the whole loop because (in-directory ...) fails, and no, I don't know how to resume this optimized loop: #lang racket ;; foo.rkt (define start-dir ".") ;; (with-handlers (((lambda (x) #t) (lambda (e) (log-warning "in-directory failed" (for ([f (in-direc

Re: [racket] testing impure stuff

2013-12-23 Thread Manfred Lotz
On Mon, 23 Dec 2013 15:20:32 -0500 Matthias Felleisen wrote: > > For that, you will need to wrap the whole loop because > (in-directory ...) fails, and no, I don't know how to resume this > optimized loop: > > #lang racket ;; foo.rkt > > (define start-dir ".") > > ;; > (with-handlers (((lam

Re: [racket] testing impure stuff

2013-12-23 Thread Manfred Lotz
I had a look into collects/racket/private/for.rkt where in-directory is defined. I have to admit that I don't understand much of the stuff as this is a level of Racket I haven't yet mastered. Nevertheless, there is (when (directory-exists? fp) (loop fp p) Here it should be

Re: [racket] testing impure stuff

2013-12-23 Thread Matthias Felleisen
Sadly, I think you may have to re-implement in-directory (with a recursive traversal like the one in for.rkt) but use file-or-directory-permission before you try to go into a subdirectory. -- Matthias On Dec 23, 2013, at 4:09 PM, Manfred Lotz wrote: > I had a look into collects/racket/privat

Re: [racket] testing impure stuff

2013-12-23 Thread Manfred Lotz
On Mon, 23 Dec 2013 16:44:03 -0500 Matthias Felleisen wrote: > > Sadly, I think you may have to re-implement in-directory (with a > recursive traversal like the one in for.rkt) but use > file-or-directory-permission before you try to go into a > subdirectory. -- Matthias > > > Yep, I did it

Re: [racket] testing impure stuff

2013-12-23 Thread Matthias Felleisen
On Dec 23, 2013, at 5:12 PM, Manfred Lotz wrote: > I think in-directory should be fixed in the long run. Agreed. -- Matthias Racket Users list: http://lists.racket-lang.org/users

Re: [racket] testing impure stuff

2013-12-23 Thread Robby Findler
Perhaps in-directory can take an optional parameter that controls whether or not to recur? Robby On Mon, Dec 23, 2013 at 4:42 PM, Matthias Felleisen wrote: > > On Dec 23, 2013, at 5:12 PM, Manfred Lotz wrote: > > > I think in-directory should be fixed in the long run. > > Agreed. -- Matthias >

Re: [racket] testing impure stuff

2013-12-23 Thread Matthias Felleisen
If you don't have permissions, you can't recur and the current implementation throws an error w/o recourse to a fix. As Manfred points out, this is a 'fair weather' function. A real implementation should resist such external mishaps. But I also agree w/ you about the parameter. It would general

Re: [racket] testing impure stuff

2013-12-23 Thread Robby Findler
I don't think the proposed fix would "resist" in this manner. The directory could be deleted between the time you check for its existence and when you ask for its contents. Robby On Mon, Dec 23, 2013 at 7:05 PM, Matthias Felleisen wrote: > > If you don't have permissions, you can't recur and th

Re: [racket] testing impure stuff

2013-12-23 Thread Manfred Lotz
On Mon, 23 Dec 2013 20:51:16 -0600 Robby Findler wrote: > I don't think the proposed fix would "resist" in this manner. The > directory could be deleted between the time you check for its > existence and when you ask for its contents. > I would differentiate between static and dynamic errors.