From 3aced33d8441b7410bfe534fb05c62a14e1c489a Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Tue, 9 Sep 2014 02:29:24 +0900 Subject: [PATCH] small refactoring --- piclib/scheme/base.scm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/piclib/scheme/base.scm b/piclib/scheme/base.scm index db0590d8..4ddabc80 100644 --- a/piclib/scheme/base.scm +++ b/piclib/scheme/base.scm @@ -197,20 +197,20 @@ (not (even? x))) (define (min . args) - (let loop ((args args) (min +inf.0)) + (define (min a b) + (if (< a b) a b)) + (let loop ((args args) (acc +inf.0)) (if (null? args) - min - (loop (cdr args) (if (< (car args) min) - (car args) - min))))) + acc + (loop (cdr args) (min (car args) acc))))) (define (max . args) - (let loop ((args args) (max -inf.0)) + (define (max a b) + (if (> a b) a b)) + (let loop ((args args) (acc -inf.0)) (if (null? args) - max - (loop (cdr args) (if (> (car args) max) - (car args) - max))))) + acc + (loop (cdr args) (max (car args) acc))))) (define (floor-quotient i j) (call-with-values (lambda () (floor/ i j))