#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::Crafting Interpreters::Ch 10 Functions
#columns:Front	Back	Tags
Crafting Interpreters ch 10, Functions: what does it cover?	Functions: call expressions, arity checks, native functions like clock(), function declarations, return statements (implemented with an exception), and closures that capture their defining environment.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::about
Crafting Interpreters ch 10, Functions: why does it matter?	Functions and closures are the heart of most modern languages. Implementing them makes callbacks, higher-order functions and closures in JavaScript or Python fully transparent.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::why
Crafting Interpreters ch 10, Functions: which part of the book is it in?	jlox (tree-walk interpreter, Java)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::part
Crafting Interpreters ch 10: what traps should you watch for?	<ul><li>Using an exception for return is correct here; do not try to &quot;fix&quot; it with flags unless you understand the trade-off.</li><li>Binding the closure to the global environment instead of the current one breaks closures.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::traps
Crafting Interpreters ch 10: which end-of-chapter challenges are worth your time?	Challenge 2 (anonymous functions) is the best one to implement. Challenge 3 is a short validity puzzle about parameters and locals. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::challenges
Crafting Interpreters ch 10, Functions: how should you work through it?	Implement, then write a counter-making function to test closures. Write a recursive Fibonacci and time it with clock() so you have a baseline to compare against clox later.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::10 cracked.guide::kind::approach
