From: Chris Hanson Date: Fri, 26 Feb 2016 08:30:57 +0000 (+0000) Subject: Implement when and unless from r7rs. X-Git-Tag: mit-scheme-pucked-9.2.12~261^2~130 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d34366c38b2828bbeb0a417850a22bd0e2bf18e5;p=mit-scheme.git Implement when and unless from r7rs. --- diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index 43e17efcf..76df49bf0 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -736,4 +736,16 @@ USA. (syntax-rules () ((ASSERT condition . extra) (IF (NOT condition) - (ERROR "Assertion failed:" 'condition . extra))))) \ No newline at end of file + (ERROR "Assertion failed:" 'condition . extra))))) + +(define-syntax :when + (syntax-rules () + ((when condition form ...) + (if condition + (begin form ...))))) + +(define-syntax :unless + (syntax-rules () + ((unless condition form ...) + (if (not condition) + (begin form ...))))) \ No newline at end of file diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index ac828021a..f59e2fcfd 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -4907,7 +4907,9 @@ USA. (local-declare :local-declare) (parameterize :parameterize) (quasiquote :quasiquote) - (receive :receive)) + (receive :receive) + (unless :unless) + (when :when)) (export (runtime) parse-define-form))