Added comments
This commit is contained in:
parent
4283d69763
commit
cabb9ca992
|
@ -2,7 +2,6 @@
|
||||||
(require plot)
|
(require plot)
|
||||||
(provide plot2d)
|
(provide plot2d)
|
||||||
|
|
||||||
;;;
|
|
||||||
;;; This implements plotting a 2d graph of a one variable function.
|
;;; This implements plotting a 2d graph of a one variable function.
|
||||||
;;; Singularities are handled properly (I think).
|
;;; Singularities are handled properly (I think).
|
||||||
|
|
||||||
|
@ -25,12 +24,17 @@
|
||||||
|
|
||||||
; These count functions are used to measure the
|
; These count functions are used to measure the
|
||||||
; number of evaluations of the function to be drawn.
|
; number of evaluations of the function to be drawn.
|
||||||
|
; They are only used during debugging.
|
||||||
(define count 0)
|
(define count 0)
|
||||||
(define (reset-count)
|
(define (reset-count)
|
||||||
(set! count 0))
|
(set! count 0))
|
||||||
(define (increase-count)
|
(define (increase-count)
|
||||||
(set! count (+ count 1)))
|
(set! count (+ count 1)))
|
||||||
|
|
||||||
|
; Plotting an arbitrary function without knowdledge of any
|
||||||
|
; points in the domain where the function can ne undefined
|
||||||
|
; risks triggering various exceptions. Handle these and
|
||||||
|
; return #f to signal x is not in the domain.
|
||||||
(define (wrap f excluded-from-domain? [value-returned-on-error #f])
|
(define (wrap f excluded-from-domain? [value-returned-on-error #f])
|
||||||
(λ (x)
|
(λ (x)
|
||||||
(with-handlers ([(λ e #t) (λ x value-returned-on-error)])
|
(with-handlers ([(λ e #t) (λ x value-returned-on-error)])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user