From b19a679b860335d2947ca9e08183b87aed4f92e4 Mon Sep 17 00:00:00 2001 From: Brady McDonough Date: Mon, 15 Mar 2021 18:02:31 -0600 Subject: [PATCH] Added more (if-some) utility --- tk/listlogic.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tk/listlogic.scm b/tk/listlogic.scm index 9c11da8..73e83df 100644 --- a/tk/listlogic.scm +++ b/tk/listlogic.scm @@ -2,7 +2,8 @@ #:export (flatten lp& l& - if-some) + if-some + if-some-else) #:duplicates (warn-override-core warn )) (define (flatten-helper lst acc stk) @@ -48,3 +49,7 @@ ;; Returns the argument if it isn't #f, otherwise returns the empty list (define (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))