Add "upply" (U-shaped apply, names are hard)
This commit is contained in:
parent
e6209fa8a4
commit
e209bfe130
5
d-.scm
5
d-.scm
@ -12,6 +12,7 @@
|
||||
partial
|
||||
argmin
|
||||
iterate
|
||||
upply
|
||||
generator
|
||||
macro-expand))
|
||||
|
||||
@ -72,6 +73,10 @@
|
||||
v
|
||||
(iterate (1- n) f (f v))))
|
||||
|
||||
(define (upply a b cmp . fs)
|
||||
(let ([arm-f (apply compose fs)])
|
||||
(cmp (arm-f a) (arm-f b))))
|
||||
|
||||
;; Shamelessly ripped from https://wingolog.org/archives/2013/02/25/on-generators
|
||||
(define (make-generator f)
|
||||
(define tag (make-prompt-tag))
|
||||
|
Loading…
Reference in New Issue
Block a user