Hand Evals in DrRacket Hand evaluation helps you learn how Racket reduces programs to values.

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

Love Lifted Me Click here to play The slides advance automatically with the words.
Do-while Loops Programming. COMP102 Prog Fundamentals I: do-while Loops /Slide 2 The do-while Statement l Syntax do action while (condition) l How it.
(define (f x) (if (< x 0) (lambda (y) (- y x)) (lambda (y) (- x y)))) GE f: P1 para:x body:(if … )
Short circuit code for boolean expressions: Boolean expressions are typically used in the flow of control statements, such as if, while and for statements,
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Winter 2013.
Factors Objective – To be able to find all the factors of a given integer.
1 PRIME FACTORIZATION. 2  Every composite number can be expressed as a product of prime numbers. This is called the prime factorization of a number.
6.001 SICP SICP – October environment Trevor Darrell 32-D512 Office Hour: W web page:
Lesson 5.2 (PART 2) FUNCTION NOTATION.
Name:________________________________________________________________________________Date:_____/_____/__________ Get Homework out FIRST! Then, begin warm-up.
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
Today’s lesson... What: Exponents Why: To evaluate #’s with both positive and negative exponents and to analyze the powers of 10.
Base: the number that is multiplied Power: the number that is expressed as the exponent Exponent: tell how many times the base is used as a factor Standard.
1 Lisp Functions –Built-in functions –Defining functions –Function Evaluation and Special Forms defun, if Control statements –Conditional if, cond –Repetition.
ㅎㅎ logical operator if if else switch while do while for Third step for Learning C++ Programming Repetition Control Structures.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
Warm- Up: Evaluate. Algebra A 1.1Variables and Expressions.
Martin-Gay, Beginning Algebra, 5ed 33 Exponents that are natural numbers are shorthand notation for repeating factors. 3 4 = is the base 4.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Copyright © 2011 Pearson, Inc. 3.4 Properties of Logarithmic Functions.
Exponent Quiz Review. Evaluate the expression 4 2  Answer: 16.
Computer Science 101 If Statement. Python Relational Operators.
PPL Lecture 4 Slides by Yaron Gonen, based on slides by Daniel Deutch and lecture notes by Prof. Mira Balaban.
1-2 Order of Operations Objective: Use the order of operations to evaluate expressions.
Your feedback matters when you provide it. New course evaluations online at the end of term! See: uoft.me/courseevaluations for more information.
EXPONENTS Basic terminology Substitution and evaluating Laws of Exponents Multiplication Properties Product of powers Power to a power Power of a product.
Evaluate the expression for the given value 1.9 b+7 when b=14 A. 189 B. 63 C. 18 D. 133.
CS314 – Section 5 Recitation 9
Notes Over 1.2.
Subtracting Integers #41.
Discriminant and Quadratic
6.001 SICP Variations on a Scheme
Absolute Value and Opposites
Chapter 3: Decisions and Loops
Sequence, Selection, Iteration The IF Statement
The interpreter.
Aim #2.2 What else is there to know about Functions and Their Graphs?
continued on next slide
Env. Model Implementation
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2013.
Scrolling text repeating until end of slide.
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Zach Tatlock Winter 2018.
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2017.
                                                                                                                                                                                                                                                
continued on next slide
continued on next slide
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Autumn 2018.
In the power 52 , the base is In the power 52 , the base is
Dynamic Scoping Lazy Evaluation
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Autumn 2017.
6.001 SICP Further Variations on a Scheme
Streams, Delayed Evaluation and a Normal Order Interpreter
Lesson 3.3 Function Notation
Exponents, Parentheses, and the Order of Operations
Introduction to Functional Programming in Racket
2. Second Step for Learning C++ Programming • Data Type • Char • Float
PRIME FACTORIZATION.
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2016.
DeMorgan's & related Laws
FUNCTION NOTATION.
A global environment val a = 15 val b = "foo"; val c = fn (n, p)
Exponents is repeated multiplication!!!
– 3.4 ANSWER 3.5 ANSWER 1.17.
Changing Data: (Continued)
This shows running the first guess number program which only allows one guess - I show the correct answer for testing purposes.
continued on next slide
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2019.
continued on next slide
Exponent practice.
Presentation transcript:

Hand Evals in DrRacket Hand evaluation helps you learn how Racket reduces programs to values

Example 1 (+ (* 2 3) 6) (+ 6 6) 12

Example 2 (define (foo x) (+ x 3)) (* (foo 5) 4) (* (+ 5 3) 4) (* 8 4) 32

Example 3 (define (foo x) (+ x 3)) (+ (foo 5) (foo 9) (foo -1)) (+ (+ 5 3) (foo 9) (foo -1)) (+ 8 (foo 9) (foo -1)) (+ 8 (+ 9 3) (foo -1)) ( (foo -1)) [see next slide]

Example 3 (cont) (define (foo x) (+ x 3)) ( (foo -1)) ( (+ -1 3)) ( ) 22

Example 4 (cond [(= 5 0) ‘never] [else (* 6 2)]) (* 6 2) 12

Summary: How to Hand Eval 1.Find the innermost expression 2.Evaluate one step 3.Repeat until all have a value