I'm not sure about this change. If I pass in a buggy function, I'm not sure I'd want the errors to get swallowed.
How about making the plot but putting a red thing on it (and maybe showing the error text on mouseover)? Or maybe making this optional behavior? Robby On Mon, Dec 17, 2012 at 6:02 PM, <ntoro...@racket-lang.org> wrote: > ntoronto has updated `master' from d120286f89 to 2657d8f96b. > http://git.racket-lang.org/plt/d120286f89..2657d8f96b > > =====[ One Commit ]===================================================== > Directory summary: > 92.4% collects/plot/common/ > 7.5% collects/plot/tests/ > > ~~~~~~~~~~ > > 2657d8f Neil Toronto <ntoro...@racket-lang.org> 2012-12-17 16:58 > : > | Plots whose functions raise errors now have an empty spot instead of > | failing > : > M collects/plot/common/sample.rkt | 9 ++++++--- > M collects/plot/tests/plot2d-tests.rkt | 2 ++ > > =====[ Overall Diff ]=================================================== > > collects/plot/common/sample.rkt > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > --- OLD/collects/plot/common/sample.rkt > +++ NEW/collects/plot/common/sample.rkt > @@ -134,7 +134,8 @@ > > (defproc (make-function->sampler [transform-thnk (-> axis-transform/c)] > ) (-> (real? . -> . real?) ivl? > sampler/c) > - (λ (f inner-ivl) > + (λ (g inner-ivl) > + (define f (λ (x) (with-handlers ([exn:fail? (λ (_) +nan.0)]) (g x)))) > (define memo (make-hash)) > (λ (outer-ivl num) > (define tx (transform-thnk)) > @@ -155,7 +156,8 @@ > ) (-> (real? real? . -> . real?) > (vector/c ivl? ivl?) > 2d-sampler/c) > - (λ (f inner-rect) > + (λ (g inner-rect) > + (define f (λ (x y) (with-handlers ([exn:fail? (λ (_) +nan.0)]) (g x > y)))) > (define memo (make-hash)) > (λ (outer-rect nums) > (define tx (transform-x-thnk)) > @@ -186,7 +188,8 @@ > ) (-> (real? real? real? . -> . real?) > (vector/c ivl? ivl? ivl?) > 3d-sampler/c) > - (λ (f inner-rect) > + (λ (g inner-rect) > + (define f (λ (x y z) (with-handlers ([exn:fail? (λ (_) +nan.0)]) (g > x y z)))) > (define memo (make-hash)) > (λ (outer-rect nums) > (define tx (transform-x-thnk)) > > collects/plot/tests/plot2d-tests.rkt > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > --- OLD/collects/plot/tests/plot2d-tests.rkt > +++ NEW/collects/plot/tests/plot2d-tests.rkt > @@ -4,6 +4,8 @@ > > ;(plot-new-window? #t) > > +(plot (function / -249 250)) > + > (time > (define xs (build-list 10000 (λ _ (random)))) > (plot (density xs 1/2))) >
_________________________ Racket Developers list: http://lists.racket-lang.org/dev