From 49c13d72c248e86e65bde977059e97b7f79a97f8 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 10 Feb 2021 16:36:10 +0530 Subject: Remove unnecessary solver type variable. * src/utils.sc (with-root-fsolver): Rewrite without a temporary solver type variable. --- src/utils.sc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src') 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))) -- cgit v1.2.3