COMPSCI 61A Lecture Notes - Operand
zogo39484755 and 6 others unlocked
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents
Document Summary
Expressions - an expression describes a computation and evaluates to a value. Ex: max (1, 2, 3) = 3 min (1, 2, 3) = 1 from operator import add, mil add (2, 3) = 5 mul (4, 5) = 20 mul (add(2, mul(4, 6)), add(3, 5)) --> nest --> 208. Call expression add ( 2 , 3 ) Procedure: eval. operator + operand, apply function that is value of operator subexpression. Evaluating nested expressions mul ( add ( 2 , mul(4, 6), add (3, 5)) mul add ( 2, mul ( 4, 6 ) ) add ( 3, 5 ) = 8 add 2 + 24 (4 * 6) Interpreter: an implementation of the procedure for evaluation. Name - expression refer to some value , can bind multiple names to multiple values def square(x): return mul(x, x) --> also nest functions square (3)