add some more functions
This commit is contained in:
parent
76b11b0cf5
commit
f3d47afc5f
12
d-.scm
12
d-.scm
@ -1,8 +1,10 @@
|
|||||||
(define-module (d-)
|
(define-module (d-)
|
||||||
|
#:use-module (srfi srfi-1)
|
||||||
#:export
|
#:export
|
||||||
(~>
|
(~>
|
||||||
~>>
|
~>>
|
||||||
partial))
|
partial
|
||||||
|
argmin))
|
||||||
|
|
||||||
(define-syntax ~>
|
(define-syntax ~>
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
@ -18,3 +20,11 @@
|
|||||||
|
|
||||||
(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)
|
||||||
|
(reduce (lambda (val min)
|
||||||
|
(if (< (f val) (f min))
|
||||||
|
val
|
||||||
|
min))
|
||||||
|
#f
|
||||||
|
vals))
|
||||||
|
Loading…
Reference in New Issue
Block a user