EECS 111 Review 11/13/2016.

Slides:



Advertisements
Similar presentations
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
Advertisements

Racket Introduction CSC270 Pepper major portions credited to
A Level Computing#BristolMet Session Objectives#U2 S8 MUST identify the difference between a procedure and a function SHOULD explain the need for parameters.
Principles of programming languages 4: Parameter passing, Scope rules Department of Information Science and Engineering Isao Sasano.
Recursion (define tell-story (lambda () (print ‘’Once upon a time there was a mountain. ‘’) (print ‘’On the mountain, there was a temple. ‘’) (print ‘’In.
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
ITERATIVE CONSTRUCTS: DOLIST Dolist is an iterative construct (a loop statement) consisting of a variable declaration and a body The body states what happens.
Topic R1 – Review for the Midterm Exam. CISC 105 – Review for the Midterm Exam Exam Date & Time and Exam Format The midterm exam will be Tuesday, 3 April.
The Scheme Programming Language History and Significance Dmitry Nesvizhsky CIS24 Professor Danny Kopec.
Computational Physics Home Assignment #3 Dr. Guy Tel-Zur.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
Introduction Dr. Ying Lu RAIK 283: Data Structures & Algorithms.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a lgorithms.
1 Documenting Your Project. 2 Documenting your Project Insert Banner Comments in your code Comment - coding statement used by humans not the compiler.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
Which Language is Better?
Chapter 9: MuPAD Programming II Procedures MATLAB for Scientist and Engineers Using Symbolic Toolbox.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Assignment: Changing Data CMSC Introduction to Computer Programming November 1, 2002.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
1 Relational Algebra and Calculas Chapter 4, Part A.
CS241 PASCAL I - Control Structures1 PASCAL Control Structures Modified Slides of Philip Fees.
Component 4/Unit 5-3. Data Type Alphanumeric (Character set: A-Z, 0-9 and some special characters) –Customer address, name, phone number, Customer ID,
Bank Account Environment Model Examples Prof. Tony White April 2010.
Searching Topics Sequential Search Binary Search.
Get out your Homework and a pencil. Be ready as soon as the bell rings! Write any questions you have on a post it note and put it on my desk by the computer.
Forms Writing your own procedures CS 480/680 – Comparative Languages.
Today… Python Keywords. Iteration (or “Loops”!) Winter 2016CISC101 - Prof. McLeod1.
Introduction To Software Development Environment.
2.1 First C Program. First Program Open visual studio, click new file Save as “programName.c” – Program must start with letter and have no spaces – Must.
Functional Programming
CS314 – Section 5 Recitation 9
Operational Semantics of Scheme
CS314 – Section 5 Recitation 10
I>clicker Session 8.
Introduction to Programming
Slide design: Dr. Mark L. Hornick
COMP 2710 Software Construction Homework 2 – Design and Algorithm
Principles of programming languages 4: Parameter passing, Scope rules
September 4, 1997 Programming Languages (CS 550) Lecture 6 Summary Operational Semantics of Scheme using Substitution Jeremy R. Johnson TexPoint fonts.
Think What will be the output?
ITM 352 Expressions, Precedence, Working with Strings Class #5
Problem Solving and Programming CS140: Introduction to Computing 1 8/21/13.
Racket Introduction CSC270 Pepper
Chap. 6 :: Control Flow Michael L. Scott.
Chapter 12: Analysis of Algorithms
Your turn (Review) What does a lambda expression return when it is evaluated? the value of a lambda expression is a procedure What three things are in.
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Procedural vs Functional Style
Chap. 6 :: Control Flow Michael L. Scott.
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
CS139 October 11, 2004.
Abstraction and Repetition
Asst. Dr.Surasak Mungsing
When a function is called...
Announcements Quiz 5 HW6 due October 23
Introduction to Algorithm and its Complexity Lecture 1: 18 slides
IPC144 Introduction to Programming Using C Week 4 – Lesson 1
Abstraction and Repetition
6.001 SICP Interpretation Parts of an interpreter
Analysis of Algorithms
Assignment Operators Topics Increment and Decrement Operators
Relational Algebra & Calculus
Rehearsal: Lazy Evaluation Infinite Streams in our lazy evaluator
Chapter 15 Functional Programming 6/1/2019.
Abstraction and Repetition
Presentation transcript:

EECS 111 Review 11/13/2016

Imperative Programming Prior to learning imperative programming, all expressions had some “value” Constants have their own value (i.e. 5 is 5) Variables have whatever value they were assigned Some special forms exist (define, local, lambda, if) If it’s none of the above, it’s a procedure call

That’s Nice and All… But imperatives are different For example, set! is a void function Ex: (define x 5) (set! x 10) > x 10

Define vs. Set! Set! changes an existing variable’s value while the program is executing Define makes new variables

Functional vs Imperative The only effect of a functional program is its return value Result does not depend on order Value determined entirely by inputs Imperative programs on the other hand… Many different effects Return value, variable changes, delete files, etc. Can influence other functions as well

Imperative Advantages Usually more efficient (less steps to machine code) = faster code Can be simpler Simulations (these are basically just a bunch of changes, so it makes sense) More natural

Composing Imperatives Sequencing Begin Conditionals If, when, unless, cond Repetition for-each recursion

begin Executes a bunch of expressions in order, and then returns the value of the last thing executed (begin (set! balance (+ balance amount)) balance) Would return balance after setting the balance to balance + amount

Imperative Special Forms Set! Begin When/unless cond

Debugging! I’d look at Ian’s slides on this, but let’s walk through an example!

Exercise 6 Any other questions? Any questions about the homework so far?