Skip to content

Commit

Permalink
(docs) improve parent.frames example
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Oct 15, 2024
1 parent 40662e8 commit 360c0db
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/docs/lips/environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 360c0db

Please sign in to comment.