feat: add flip and swap combinators to (radix combinators) module

pull/1/head
anemofilia 2023-08-27 19:11:01 -03:00
parent 43bfb6cfc9
commit 2b8f36bfa9
No known key found for this signature in database
GPG Key ID: 5A8F3D62C87A2B33
1 changed files with 8 additions and 1 deletions

View File

@ -6,7 +6,9 @@
any-of
conjoin
disjoin
inclusive-disjoin))
inclusive-disjoin
flip
swap))
(define ((all-of pred) lst)
(null? (filter (negate pred) lst)))
@ -37,3 +39,8 @@
((not (apply head-pred args)) (loop tail-preds))
(else #f)))))
(define ((flip proc) . args)
(apply proc (reverse args)))
(define ((swap proc) arg1 arg2 . args)
(apply proc arg2 arg1 args))