(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))))
;; Returns the argument if it isn't #f, otherwise returns the empty list
(define (if-some $cond)
(if $cond $cond '()))
(define-syntax if-some
(syntax-rules ()
((if-some $cond)
(if $cond $cond '()))))
;; Returns the first argument if it isn't #f, otherwise returns the second.
(define (if-some-else $cond $else)
(if $cond $cond $else))
(define-syntax if-some-else
(syntax-rules ()
((if-some-else $cond $else)
(if $cond $cond $else))))

Loading…
Cancel
Save