From 360c0dbc9665c070d8cab586e921d446aa68645d Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Tue, 15 Oct 2024 11:48:24 +0200 Subject: [PATCH] (docs) improve parent.frames example --- docs/docs/lips/environments.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/docs/lips/environments.md b/docs/docs/lips/environments.md index dce3a0e9..e95aec3c 100644 --- a/docs/docs/lips/environments.md +++ b/docs/docs/lips/environments.md @@ -103,22 +103,24 @@ call stack environments. ```scheme (define (foo) - (define x 10) + (define x 20) (bar)) (define (bar) - (define x 20) + (define x 30) (baz)) (define (baz) (for-each (lambda (env) (let-env env (print x))) - ;; car is top level environment - (cdr (parent.frames)))) + (parent.frames))) + +(define x 10) (foo) ;; ==> 10 ;; ==> 20 +;; ==> 30 ``` You can mix lexical scope chain with frames: