-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let bindings are technically done, but until lambdas can capture thei…
…r environment they will not work
- Loading branch information
Your Name
committed
Nov 16, 2020
1 parent
c1728b8
commit 037e7ca
Showing
5 changed files
with
23 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
(define (f a) | ||
(let ((b 3) (c 4)) | ||
(* a (* b c)))) | ||
(display (f 2)); wrong result! is 36, should be | ||
| | ||
(define (g a) (let ((b 3)) (* a b))) | ||
(display (g 2)) | ||
(newline) | ||
| | ||
|
||
(define (f a) ((lambda (b) (* a b)) 3)) | ||
(display (f 2)); Weird! Both are wrong. Both are 9 when they should be 6. | ||
; For this to work, that lambda has to be able to capture its surrounding environment. | ||
; 1. How would it do that? | ||
; 2. What is making it behave not as expected right now? (or why is it squaring the first argument?) |