diff --git a/CHANGELOG.md b/CHANGELOG.md index 08c46d2f..cd48329c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ Features Bug Fixes +- Prevent an error when evaluating a `begin` expression that contains both a macro definition and an application of that macro. For example: + + begin (define-syntax foo (syntax-rules () ((foo) 123))) (foo)) + - Fix a regression where `c-compiler-options` was not recognized as a top level form by programs. - Enforce a maximum recursion depth when printing an object via `display` and `write`, and when comparing objects via `equal?`. This prevents segmentation faults when working with circular data structures. diff --git a/scheme/eval.sld b/scheme/eval.sld index f45ec40a..ba33ae11 100644 --- a/scheme/eval.sld +++ b/scheme/eval.sld @@ -636,14 +636,9 @@ ;(display "/* ") ;(write (list exp)) ;(display "*/ ") - (let ((fncs - ;; Our map starts from the end, we reverse - ;; so everything is evaluated in order, then - ;; reverse again so results are in order - (reverse - (map (lambda (expr) - (analyze expr a-env rename-env local-renamed)) - (reverse (cdr exp)))))) + (let ((fncs (Cyc-map-loop-1 (lambda (expr) + (analyze expr a-env rename-env local-renamed)) + (cdr exp)))) (lambda (env) (foldl (lambda (fnc _) (fnc env)) #f fncs)))) ;; compiled macro