midterm_review

midterm_review - Caltech CS 1 Fall 2008 CS1 Introduction to...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Caltech CS 1 -- Fall 2008 CS1: Introduction to Computation Midterm Review Caltech CS 1 -- Fall 2008 Midterm • ... on the web site Real Soon Now • Find linked from CS 1 home page – and in "schedule" section • Due date: Tuesday, November 4, 5 PM – Lab 5 also due Thurs night 2am (Nov. 6) – yes, it sucks Caltech CS 1 -- Fall 2008 Midterm • Five hour time limit – (it shouldn’t really take five hours) • Closed book, closed interpreter • No references except: – your own labs and TA's comments on them – electronic version of lecture slides – The Scheme standard (R5RS) • No collaboration! Caltech CS 1 -- Fall 2008 Midterm • Five hour time limit – OK if not consecutive five hours, BUT – cannot go to CS 1 lecture, recitation, etc. between start and finish – shouldn't take more than 4 hours Caltech CS 1 -- Fall 2008 Submission • Submit electronically, plain text format • Submit to CS1man as an assignment called "midterm" • Don't submit e.g. PDF, Word doc • Make fit into 80 columns – we have to print it out to grade it • Penalties imposed for violating these rules! • OK to use editor which matches parentheses – …as long as it’s not DrScheme… – e.g. emacs, gedit Caltech CS 1 -- Fall 2008 Grading • Score between 0.0 and 6.0 • No min grading Caltech CS 1 -- Fall 2008 Midterm structure Four parts to midterm: • 1) Substitution model • 2) Asymptotic time complexity • 3) Recursion and function design • 4) Higher-order procedures and abstraction • Only material through Day 7. • No cons/car/cdr stuff. Caltech CS 1 -- Fall 2008 Substitution model • Thought process: • 1) Is this a special form? – define , lambda , if , cond , and , or – if so, use evaluation rule for that special form Caltech CS 1 -- Fall 2008 Substitution model • Thought process: • 2) Otherwise: – evaluate operands – evaluate operator – apply operator to operands Caltech CS 1 -- Fall 2008 Apply operator to operands • If built-in procedure ( + , * etc.) – just do it • Otherwise, – procedure is a lambda expression – substitute values for variables in argument list of lambda expression, into the body – evaluate the resulting expression Caltech CS 1 -- Fall 2008 Exception • When do we not substitute values for variables in lambda expression? • Lambda shielding Caltech CS 1 -- Fall 2008 define • Expect that you evaluate all define s • Even e.g. (define x 2) should be evaluated • Be aware of whether define is sugared or not! – if sugared, you need to explicitly desugar it – if first operand has parens, it’s sugared Caltech CS 1 -- Fall 2008 define (define x 2) – Obviously not sugared (define f (lambda (x) (* x (+ x 3)))) – First operand doesn’t have parentheses… – Not a sugared lambda expression Caltech CS 1 -- Fall 2008 define (define (f x) (lambda (y) (* x (+ y 3)))) – Definitely sugared! Desugars to: (define f (lambda (x) (lambda (y) (* x (+ y 3))))) – This function returns another function Caltech CS 1 -- Fall 2008...
View Full Document

This note was uploaded on 09/25/2010 for the course CS 1a taught by Professor Vanier during the Fall '09 term at Caltech.

Page1 / 55

midterm_review - Caltech CS 1 Fall 2008 CS1 Introduction to...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online