Plots whose functions raise errors now have an empty spot instead of
failing
This commit is contained in:
parent
d120286f89
commit
2657d8f96b
|
@ -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))
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
;(plot-new-window? #t)
|
||||
|
||||
(plot (function / -249 250))
|
||||
|
||||
(time
|
||||
(define xs (build-list 10000 (λ _ (random))))
|
||||
(plot (density xs 1/2)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user