(if-some) should have been a macro to start with

master
Brady McDonough 5 years ago
parent b19a679b86
commit a1c369ad4d

@ -47,9 +47,13 @@
(else (lp& eqv? ls1 ls2)))) (else (lp& eqv? ls1 ls2))))
;; Returns the argument if it isn't #f, otherwise returns the empty list ;; Returns the argument if it isn't #f, otherwise returns the empty list
(define (if-some $cond) (define-syntax if-some
(if $cond $cond '())) (syntax-rules ()
((if-some $cond)
(if $cond $cond '()))))
;; Returns the first argument if it isn't #f, otherwise returns the second. ;; Returns the first argument if it isn't #f, otherwise returns the second.
(define (if-some-else $cond $else) (define-syntax if-some-else
(if $cond $cond $else)) (syntax-rules ()
((if-some-else $cond $else)
(if $cond $cond $else))))

Loading…
Cancel
Save