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)
|
||||
(lambda x (apply fn (append args x))))
|
||||
|
||||
(define (argmin f . vals)
|
||||
(define (argmin arg lt? . vals)
|
||||
(reduce (lambda (val min)
|
||||
(if (< (f val) (f min))
|
||||
(if (lt? (arg val) (arg min))
|
||||
val
|
||||
min))
|
||||
#f
|
||||
|
Loading…
Reference in New Issue
Block a user