Must provide a predicate to argmin
This commit is contained in:
parent
56594fd146
commit
87384f611c
4
d-.scm
4
d-.scm
@ -48,9 +48,9 @@
|
|||||||
(define (partial fn . args)
|
(define (partial fn . args)
|
||||||
(lambda x (apply fn (append args x))))
|
(lambda x (apply fn (append args x))))
|
||||||
|
|
||||||
(define (argmin f . vals)
|
(define (argmin arg lt? . vals)
|
||||||
(reduce (lambda (val min)
|
(reduce (lambda (val min)
|
||||||
(if (< (f val) (f min))
|
(if (lt? (arg val) (arg min))
|
||||||
val
|
val
|
||||||
min))
|
min))
|
||||||
#f
|
#f
|
||||||
|
Loading…
Reference in New Issue
Block a user