Home
Alexander Lu
Cancel

CS61A: Calculator

Exceptions Exceptions allow us to raise an error for unexpected behaviors We may raise exceptions with the raise statement in Python: raise <expression> Expression must evaluate t...

CS61A: Scheme Lists

Lists Every list in Scheme is a linked list. Names for linked list: cons: Two-argument procedure that creates a linked list car: Procedure that returns the first element of a ...

CS61A: Lecture 26

Scheme Lists Scheme lists are written in parentheses with elements separated by spaces Procedures cons: Procedure that creates a new list. car: Procedure that prints out the f...

CS61A: Scheme

Scheme Scheme is a dialect of lisp Scheme programs consist of expressions: Primitive expressions: 2, 3.3, true, +, quotient, … “quotient” names Scheme’s built-in ...

CS61A: Lecture 25

Lecture - The Scheme Programming Language 2 Reasons Concepts in Python transfers into another programing language Build an interpreter for Scheme A program th...

CS61A: Lecture 22

Lecture Tree Class A Tree has a label and a list of branches; each branch is also a Tree class Tree: def __init__(self, label, branches=[]): self.label = label for branch i...

CS61A: Lecture 23

Measuring Efficiency Efficiency is the measure of how long our program would take to run. Ex: The recursive computation of the fibonacci sequence def fib(n): if n == 0: return 0 ...

CS61A: Efficiency

Measuring Efficiency Efficiency is the measure of how long our program would take to run. Ex: The recursive computation of the fibonacci sequence def fib(n): if n == 0: return 0 ...

CS61A: Composition

Linked Lists A type of recursive data structure that stores a sequence of values. A linked list is either empty a first value and the rest of the linked list Thus, a...

CS61A: Representation

String Representations An object value should behave like the kind of data it is meant to represent Part of this ability is to provide a string representation of a program T...