diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/utils.sc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/utils.sc b/src/utils.sc index db59e15..a481109 100644 --- a/src/utils.sc +++ b/src/utils.sc @@ -74,15 +74,12 @@ the range [0,pi]." exact value EXACT." (return (fabs (- 1 (/ approx exact))))) -(sc-define-syntax* (with-root-fsolver solver solver-type function a b body ...) - (let ((solver-type-var (sc-gensym))) - `(begin - (let* ((,solver-type-var (const gsl-root-fsolver-type*) ,solver-type)) - (with-alloc solver gsl-root-fsolver* - (gsl-root-fsolver-alloc ,solver-type) - gsl-root-fsolver-free - (gsl-root-fsolver-set solver ,function ,a ,b) - ,@body))))) +(sc-define-syntax (with-root-fsolver solver solver-type function a b body ...) + (with-alloc solver gsl-root-fsolver* + (gsl-root-fsolver-alloc solver-type) + gsl-root-fsolver-free + (gsl-root-fsolver-set solver function a b) + body ...)) (sc-define-syntax* (with-error-handler handler body ...) (let ((old-handler (sc-gensym))) |