if-not and when-not

This commit is contained in:
2024-10-25 15:48:01 -05:00
parent f3d47afc5f
commit d9081bcffb
2 changed files with 17 additions and 0 deletions

8
d-.scm
View File

@@ -3,6 +3,8 @@
#:export
(~>
~>>
if-not
when-not
partial
argmin))
@@ -18,6 +20,12 @@
[(_ v (fn args ...) more ...) (~> (fn args ... v) more ...)]
[(_ v fn more ...) (~> (fn v) more ...)]))
(define-syntax-rule (if-not pred body ...)
(if (not pred) body ...))
(define-syntax-rule (when-not pred body ...)
(when (not pred) body ...))
(define (partial fn . args)
(lambda x (apply fn (append args x))))