CS3: Introduction to Symbolic Programming - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

CS3: Introduction to Symbolic Programming

Description:

takes a sentence of two words, returns the first two letters (as a word) Slide 6. CS3 spring 05 ... Data abstraction. Selectors! Constructors! Slide 7. CS3 ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 10
Provided by: natetit
Category:

less

Transcript and Presenter's Notes

Title: CS3: Introduction to Symbolic Programming


1
CS3 Introduction to Symbolic Programming
  • Instructor Nate Titterton
  • Email nate_at_socrates.berkeley.edu

2
Announcements
  • Nate's office hours
  • Wed 2-4
  • 329 Soda
  • Get your card keys

3
Any questions?
  • Grading?
  • Working at home?

4
Review
  • What is Scheme?
  • (interpreter, editor)
  • Functions
  • Words and Sentences

5
Some programming
  • first-two
  • takes a word, returns the first two letters (as a
    word)
  • two-first
  • takes a sentence of two words, returns the first
    two letters (as a word)

6
A big idea
  • Data abstraction
  • Selectors!
  • Constructors!

7
Coming up conditionals
  • Conditionals allow programs to do different
    things depending on data values
  • To make decisions
  • "Intelligence" depends on this

8
Structure of conditionals
  • (if lttrue? or false?gt ltdo something if
    truegt ltdo something if falsegt)
  • (define (smarty x)
  • (if (odd? x)
  • (se x '(is odd))
  • (se x '(is even))))

9
true? or false? Boolean!
  • With conditionals, we need something that
    represents TRUE and FALSE.
  • t and f
  • in practice, everything is true except f
  • false is true!
  • (really, false is t)
  • Predicates procedures that return t or f
  • by convention, their names end with a "?"
Write a Comment
User Comments (0)
About PowerShow.com