COMPSCI 61A Lecture 5: CS 61A LEC 05

34 views1 pages
zogo39484755 and 6 others unlocked
COMPSCI 61A Full Course Notes
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents

Document Summary

Environment diagrams already handle the case of higher-order functions. When a function is defined inside another function, it is not assigned to a value until the parent function is called. Returning a function assigns the function to a name in the global frame. However when that function is called in the global frame, its parent is still the frame of the function where it was created. The parent of a function is the current frame when that function is created. Allows you to establish a proper environment for when the function is called. Every-user defined function has a parent frame (often global) Create a function value: func () [parent=] Bind to the function value in the current frame. Add a local frame, titled with the of the function being called. Copy the parent of the function into the local frame: [parent=] Bind the to the arguments in the local frame.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents