CMPU-101 Lecture Notes

Spring 2013

Lecture 22

Lecture 21

  • April 24,25,29 and 30: Lecture 21 notes (.txt)Lecture 21 notes (.rkt)
    Latest copies of lect21 notes were posted on 5/14/13 at 7 am
  • Another self-referential data type: Trees
    1. binary trees
    2. binary search trees
      • Inserting nodes into binary search trees
      • Using the binary search tree properties to potentially shorten search process.

Lecture 20

  • April 22 and 23: Lecture 20 notes (.txt)Lecture 20 notes (.rkt)
    Latest copies of lect20 notes were posted on 4/25/13 at 1:33 pm
  • String processing
    • Main approaches:
      1. Using recursion on the position number to traverse a string.
      2. Using explode on the string (making a list) and either using explicit list recursion or a higher-order function for lists.
  • Using the character data type
    1. string-ref produces character at particular position in a string.
    2. There are numerous character functions to use on the result of string-ref.
    3. string consumes a number of characters and converts them into a single string.
  • Examples:
    1. Writing a function to detect vowels
    2. Writing a palindrome detector
    3. Writing an interactive pig-latin translator

Lecture 19

Lecture 18

  • April 15 and 16: Lecture 18 notes (.txt)Lecture 18 notes (.rkt)
    Last updated on 4/17/13 at 8:50 am.
  • Writing animations
    1. big bang function
    2. working with simulation started in homework 6
    3. using on-key clause to respond to key presses
    4. using stop-when clause to end the simulation and to create a final scene
  • Mutation using set!
  • Look up big-bang in the help desk. Read section 2.4 of the help desk page that opens when you search for big-bang Worlds and the Universe: “universe.ss” up to and including sections 2.4.3.
  • Read Chapter 6 (pages 91-107) and chapter 18 (pages 247-254) in the book “Picturing Programs” (posted on the left side of this screen). They define functions without explicitly using lambda. Otherwise, the examples should be understandable. To run the examples, you should add the line (require picturing-programs) to the top of your code.

Lecture 17

  • Writing functions that process and produce lists of posns.
  • Writing animations
    1. big bang function
  • Look up big-bang in the help desk. Read section 2.4 of the help desk page that opens when you search for big-bang Worlds and the Universe: “universe.ss” up to and including sections 2.4.3.
  • Read Chapter 6 (pages 91-107) in the book “Picturing Programs” (posted on the left side of this screen). They define functions without explicitly using lambda. Otherwise, the examples should be understandable. To run the examples, you should add the line (require picturing-programs) to the top of your code.

Lecture 16

  • April 8 and 9: Worked Lecture 16 notes (.txt)Worked Lecture 16 notes (.rkt) (posted on 4/11/13 at 8:02 pm)
  • Review writing animations
    1. animate function: This function has been replaced and made obsolete by the big-bang simulation code.
    2. big bang function
      • on-draw, on-tick, and stop-when clauses
  • Several improvements to rocket landing scene.
  • Sections 1.3-1.7 of HtDP 2nd edition. Section 2.5 through 2.7 of HtDP 2nd edition. When looking at the examples in this book, remember that they define functions without explicitly using lambda. Otherwise the examples should be understandable.
  • Look up big-bang in the help desk. Read section 2.4 of the help desk page that opens when you search for big-bang Worlds and the Universe: “universe.ss” up to and including sections 2.4.3.
  • Read Chapter 6 (pages 91-107) in the book “Picturing Programs” (posted on the left side of this screen). They define functions without explicitly using lambda. Otherwise, the examples should be understandable. To run the examples, you should add the line (require picturing-programs) to the top of your code.

Lecture 15

  • Writing animations
    1. animate function
    2. big bang function
      • on-draw, on-tick, and stop-when clauses
  • Sections 1.3-1.7 of HtDP 2nd edition. When looking at the examples in this book, remember that they define functions without explicitly using lambda. Otherwise the examples should be understandable.
  • Look up big-bang in the help desk. Read section 2.4 of the help desk page that opens when you search for big-bang Worlds and the Universe: “universe.ss” up to and including sections 2.4.3.

Lecture 14

  • Containers for finite amounts of data: structs
    • Built-in posn and color structs
    • Creating new types using define-struct
      1. Functions created by define-struct: constructor, accessors, mutators, type-checker
  • Sections 6.1 and 6.3 in HtDP 1st edition. When looking at the examples in this book, remember that they define functions without explicitly using lambda. Otherwise the examples should be understandable.

Lecture 13

  • Reading input from the keyboard
    • Using the read function.
  • Using a let expression as a slightly abbreviated form of local (information on the let expression can be found on pages 62-65 of Part 4 of our pdf notes, included with lecture 6).
  • Creating interactive programs involving random events and input from keyboard.
  • Reading assignment:

Lecture 12

Lecture 11

  • Mar 4 & 5: Lecture 11 (.txt) Lecture 11 (.rkt) These are the solution files.
  • Built-in functions for flat lists: append, list-ref, reverse, length, list, and member?.
  • Writing functions that produce lists.

Lecture 10

Lecture 9

Lecture 8

Lecture 7

Lecture 6

Lecture 5

Lecture 4

Lecture 3

Lecture 2

    • Reading assignments:
    • Looking up library function names.
    • Reading library function contracts.
    • Default evaluation and pattern of primitive function calls.
    • Prefix notation. Converting infix to prefix notation.
    • Evaluation of nested function calls.
    • DISPLAY, PRINTF, and NEWLINE functions.

Lecture 1

    1. Review of on-line syllabus.
    2. Reading assignment: Part 1, pages 1-21
    3. Introduction to Racket
      • Syntax vs Semantics
      • Functional languages: function evaluation central part of computational model.
    4. Programming entities (i.e., data types) and keywords (special forms).
    5. Evaluation of primitive and compound data types.
    6. Introduction to Global Environment (GE).
    7. Default evaluation of non-empty, non-quoted lists.
    8. Software you will need and how to download it
      • DrRacket: an Integrated Development Environment.
    9. File extensions and their meaning.
    10. Introduction to CS accounts in Lab 1 on Jan 25th and 29th.
courses/cs101-201301/lectures/top.txt · Last modified: 2013/05/14 07:15 by walter
VCCS Top Events Extended Site Search Login Vassar Science Web Vassar Home Driven by DokuWiki Valid XHTML 1.0