feat: add flip and swap combinators to (radix combinators) module
parent
43bfb6cfc9
commit
2b8f36bfa9
|
@ -6,7 +6,9 @@
|
||||||
any-of
|
any-of
|
||||||
conjoin
|
conjoin
|
||||||
disjoin
|
disjoin
|
||||||
inclusive-disjoin))
|
inclusive-disjoin
|
||||||
|
flip
|
||||||
|
swap))
|
||||||
|
|
||||||
(define ((all-of pred) lst)
|
(define ((all-of pred) lst)
|
||||||
(null? (filter (negate pred) lst)))
|
(null? (filter (negate pred) lst)))
|
||||||
|
@ -37,3 +39,8 @@
|
||||||
((not (apply head-pred args)) (loop tail-preds))
|
((not (apply head-pred args)) (loop tail-preds))
|
||||||
(else #f)))))
|
(else #f)))))
|
||||||
|
|
||||||
|
(define ((flip proc) . args)
|
||||||
|
(apply proc (reverse args)))
|
||||||
|
|
||||||
|
(define ((swap proc) arg1 arg2 . args)
|
||||||
|
(apply proc arg2 arg1 args))
|
||||||
|
|
Loading…
Reference in New Issue