Skip to content

Commit 550039e

Browse files
markdown improvements
1 parent 2951e88 commit 550039e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lexicalscoping.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,22 @@ x <<- 42 # assigns the value 42 to variable `x` in the containing environme
146146
Perhaps the crude graphic can illuminate the effects of lexical scoping on variables a better than mere words.
147147
```
148148
+———————————+
149-
| (1a) x <- 0 becomes 42 | outer function / by default the global lexical scope is an anonymous function
150-
| (1b) x <- 42 by |
151-
| (3b) x <<- 42 |
152-
| +—————————–+ |
153-
| | (2) x <- 3.14 | | inner function
154-
| | (3a) x <<- 42 does | |
155-
| | not affect | |
156-
| | (2) | |
157-
| +—————————–+ |
149+
| (1a) x <- 0 becomes 42
150+
| outer function / by default the global lexical scope is an anonymous function
151+
| (1b) x <- 42 by
152+
|
153+
| (3b) x <<- 42
154+
|
155+
| +—————————–+
156+
| | (2) x <- 3.14
157+
| | inner function
158+
| | (3a) x <<- 42 does not affect (2)
159+
| |
160+
| +—————————–+
158161
+———————————+
159162
```
160163

161-
Flow of execution is (1a) -> [(2) & (3a)] -> [(3b) & (1b)] -> (1a). I used the labels “inner function” and “outer function” because the same rules apply to nested functions.
164+
Flow of execution is `(1a) -> [(2) & (3a)] -> [(3b) & (1b)] -> (1a)`. I used the labels “inner function” and “outer function” because the same rules apply to nested functions.
162165

163166
## Unit tests (with expected output) for Programming Assignment 2
164167

0 commit comments

Comments
 (0)