Home
Alexander Lu
Cancel

CS61A: Programs as Data

Programs as Data Scheme programs consist of expressions that can either be primitive* or **combinations. The built-in Scheme list data structure (a linked list) is used to represent combinatio...

CS61A: Lecture 29

Programs as data A scheme expression is just a scheme list. Thus, we may use scheme to write scheme programs ourselves Built-in Scheme list data strucutre may represent combinations Ex: sc...

CS61A: Lecture 28

Interpreters The scheme interpreter represents expressions as Pairs. For the operands, we must evaluate each of the values individually. This is because we may have compound expressio...

CS61A: Interpreters

Interpreting Scheme There are two parts to an interpreter Eval: The eval evaluates primitive and combined expressions. It calls apply to apply a procedure to certain arguments in expr...

CS61A: Lecture 27

List Processing Procedures Review Built-in Methods: -(append s t): Concatenates two or more lists together into a new list -(map f s): Call a procedures f on each element of a list and retur...

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...