diff --git a/beautiful-racket-demo/basic-demo-3/misc.rkt b/beautiful-racket-demo/basic-demo-3/misc.rkt index b05275d..90f108b 100644 --- a/beautiful-racket-demo/basic-demo-3/misc.rkt +++ b/beautiful-racket-demo/basic-demo-3/misc.rkt @@ -18,12 +18,17 @@ (define-macro (b-export NAME) #'(void)) -(define-macro (b-repl . REPL-INPUTS) - (with-pattern ([INPUTS (pattern-case-filter #'REPL-INPUTS - [(b-expr . EXPR-ARGS) - #'(b-print (b-expr . EXPR-ARGS))] - [(b-print . PRINT-ARGS) - #'(b-print . PRINT-ARGS)] - [OTHER - #'(error 'invalid-repl-input)])]) +(define-macro (b-repl . ALL-INPUTS) + (with-pattern + ([INPUTS (pattern-case-filter #'ALL-INPUTS + [(b-print . PRINT-ARGS) + #'(b-print . PRINT-ARGS)] + [(b-expr . EXPR-ARGS) + #'(b-print (b-expr . EXPR-ARGS))] + [(b-let ID VAL) + #'(define ID VAL)] + [(b-def FUNC-ID VAR-ID ... EXPR) + #'(define (FUNC-ID VAR-ID ...) EXPR)] + [ANYTHING-ELSE + #'(error 'invalid-repl-input)])]) #'(begin . INPUTS))) \ No newline at end of file