/avatar.jpg

Lec30-Tail Calls

Tail Calls Functional Programming Tail Call 相同时间复杂度,对空间复杂度的限制,常量空间运行 get the len of a list Map and Reduce Reduce eg 1 (reduce * '(3 4 5) 2) ; 120 Map Map with only a constant numbers of Frames General Computing Machine 😮

Lec28-Calculator

Calculator Exception 1 raise Exception("Invalid input") 1 2 3 4 try: # code that may raise an exception except Exception as e: print(e) 见java try-catch 😏 1 2 float('inf') # positive infinity float('-inf') # negative infinity Programming Languages Programs are trees… and the way interpreters work is through a tree recursion. Parsing 把文本转化为抽象语法树(Abstract Syntax Tree,AST) base case: only symbols and numbers recursive case: expressions and statements Scheme-Syntax Calculator using Python Pair to describe pairs of expressions and statements