Home
Alexander Lu
Cancel

CS61A: Lambda Expressions

Lambda Expressions Expressions that evaluate to a function. We can directly assign a name to a function without defining it in our frame with def x = 10 square = x * x ...

CS61A: Environments for Higher-Order Functions

Higher Order Functions are enabled by Environments Higher-order Function: A function that takes a function as an argument or returns a function as a return value. def apply_twice(f, x): return...

CS61A: Lecture 4

Designing Functions A function’s domain is the set of all inputs it might possibly take as arguments. A function’s range is the set of output values it might possibly return ...

CS61A: Lecture 3

Control Print and None Pure functions just returns a value. None-pure functions have a side effect. Print is a none-pure function that always returns None, but also displays a given value. ...

CS61A: Lecture 3

Control Print and None Pure functions just returns a value. None-pure functions have a side effect. Print is a none-pure function that always returns None, but also displays a given value. ...

CS61A: Higher-Order Functions

Higher-Order Functions Allow to design functions with very general methods of computation A function that takes another function as an argument Generalizing Patterns with Arguments For ce...

CS61A: Control

Control Control statements such as if and while control which portions of code are executed, when they are executed, and how many times. If Statements and Call Expressions Every clause is c...

CS61A: Iteration

Iteration The act of repeating things. In programming, we use loops to perform iteration. While Statements Compound statement that contains a condition (header) and a suite of expressions...

CS61A: Conditional Statements

Statements Statements are executed by the interpreter to perform an action A Compound Statement is a statement that can span over multiple lines. A Clause is a single header followe...

CS61A: Multiple Environments

Multiple Environments Tracing a User-Defined Function Code Behind the Scenes Def Statement A new function is created! The name is bounded to the ...