Abstraction
CS61A
Structure and Interpretation of Computer Programs
Functions as the unit of thought: higher-order functions, recursion, data abstraction, and writing an interpreter.
Computer science, worked through
Course notes from CS61A to CS162, an interactive introduction to Swift, and the thinking that piles up while building real projects.
func square(_ x: Int) -> Int {
x * x
}
let squares = [1, 2, 3].map(square)
print(squares) // [1, 4, 9]Learn Swift
def square(x):
return x * x
squares = list(map(square, [1, 2, 3]))
print(squares) # [1, 4, 9]CS61A
static int square(int x) {
return x * x;
}
int[] squares = IntStream.of(1, 2, 3)
.map(Main::square).toArray(); // [1, 4, 9]CS61B
int square(int x) {
return x * x;
}
int squares[] = {1, 2, 3};
for (int i = 0; i < 3; i++)
squares[i] = square(squares[i]); // {1, 4, 9}CS61C
01
Berkeley’s CS sequence, one layer of abstraction at a time: from functions, to data structures, to the machine, to the operating system.
Abstraction
CS61A
Functions as the unit of thought: higher-order functions, recursion, data abstraction, and writing an interpreter.
Data structures
CS61B
How data is organized, and what that costs: lists, trees, hashing, graphs, and asymptotic analysis.
The machine
CS61C
From C down to RISC-V, logic, caches, and parallelism: what actually happens when a program runs.
The operating system
CS162
Processes, threads, synchronization, scheduling, virtual memory, and file systems, built inside a teaching kernel.
02 · Interactive tutorial
Modeled on the official Swift documentation and the rhythm of CS61A: a short idea, a small program, then a question about what it will do before you run it.
let numbers = [3, 1, 2]
print(numbers.sorted().first!)Answer1
sorted() returns a new array, [1, 2, 3], and first is its first element. The ! unwraps the optional, which is safe here because the array is not empty.
03
Longer builds, with the reasoning behind their design.
A project introduction, with the design decisions and trade-offs behind it, is being written.
04
The first notes will appear here once they are ready to read.