about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2021-05-07 16:42:25 +0530
committerArun Isaac2021-05-07 16:42:25 +0530
commit319dea49745c0f1b7c95fe8e3078794407c4c7c6 (patch)
treea8e0581402d7014fe6c1536dce0409be281fc800
parent932efe1a370e7a8c9f6c7a2dd0beddb36fb7a601 (diff)
downloadnsmc-319dea49745c0f1b7c95fe8e3078794407c4c7c6.tar.gz
nsmc-319dea49745c0f1b7c95fe8e3078794407c4c7c6.tar.lz
nsmc-319dea49745c0f1b7c95fe8e3078794407c4c7c6.zip
Define when and unless sc macros.
* src/macros/macros.sc (when, unless): New macros.
-rw-r--r--src/macros/macros.sc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/macros/macros.sc b/src/macros/macros.sc
index ac9e6d7..5ba9e1f 100644
--- a/src/macros/macros.sc
+++ b/src/macros/macros.sc
@@ -17,6 +17,15 @@
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with nsmc.  If not, see <https://www.gnu.org/licenses/>.
 
+(sc-define-syntax (when condition body ...)
+  (cond
+   (condition
+    body ...)))
+
+(sc-define-syntax (unless condition body ...)
+  (when (not condition)
+    body ...))
+
 (sc-define-syntax (for-i index limit body ...)
   (for ((define index int 0)
         (< index limit)