foldr CS 5010 Program Design Paradigms Lesson 5.4

Size: px
Start display at page:

Download "foldr CS 5010 Program Design Paradigms Lesson 5.4"

Transcription

1 oldr CS 5010 Program Design Paradigms Lesson 5.4 Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1

2 Introduction In this lesson, we will explore another common pattern in unctions deined by the list template. We will generalize this to a unction called oldr. We will visualize how oldr works, and show an important application area. 2

3 Learning Objectives At the end o this lesson you should be able to: describe, recognize, and use the oldr pattern. 3

4 What else could be dierent? ;ListONumber -> ListONumber (deine (add-1-to-each lon) (cond [(empty? lon) empty] [(else (cons (add1 (irst lon)) (add1-to-each (rest lon))))])) ;ListOEmployee -> ListOString (deine (extract-names lop) (cond [(empty? lop) empty] [else (cons (Employee-name (irst lop)) (extract-names (rest lop)))])) Here is the example we used to introduce map. In this example, both o the brown unctions are cons, but in some other unction there could be something else in that position. 4

5 Another example ;; ListONumber -> Number (deine (sum lon) (cond [(empty? lon) 0] [else (+ (irst lon) (sum (rest lon)))])) ;; ListONumber -> Number (deine (product lon) (cond [(empty? lon) 1] [else (* (irst lon) (product (rest lon)))])) Both these unctions take a list o numbers and return a number. sum returns the sum o the elements o the given list. product returns the product o the elements o the given list. These unctions are just alike, except or the dierences marked in red and green. 5

6 Let's generalize these sum and product can be generalized to a unction we call oldr, with two new arguments: one called cn, or the unction in the green position, and one called val, or the value in the red position. The strategy or oldr is using the template or ListOX on its list argument. Our original sum and product unctions can be recreated by supplying + and 0, or * and 1, as the two arguments. The strategy or these new versions o sum and product is "Use HOF oldr on...". The name oldr is a standard name or this unction, so that is the name we will use. oldr is already deined in ISL, so you don't need to write out the deinition. Let's look at the code: 6

7 Create two new arguments or the two dierences. We call this "oldr" (we'll explain the name later) (deine (oldr cn val lon) (cond [(empty? lon) val] [else (cn (irst lon) (oldr cn val (rest lon)))])) ;; strategy: Use HOF oldr on lon (deine (sum lon) (oldr + 0 lon)) (deine (product lon) (oldr * 1 lon)) This is predeined in ISL, so you don't need to write out this deinition 7

8 What is the purpose statement? ;; oldr : (X Y -> Y) Y ListOX -> Y ;; RETURNS: the result o applying on the ;; elements o the given list ;; rom right to let, starting with base. ;; (oldr base (list x_1... x_n)) ;; = ( x_1... ( x_n base)) 8

9 What is the contract or oldr? Based on our two examples we might guess the ollowing contract or oldr: Here is one guess or the contract or oldr, based on our two examples: oldr : (Number Number -> Number) Number ListONumber -> Number This works, because + and * both have contract (Number Number -> Number), and 0 and 1 are both numbers. 9

10 What is the contract or oldr? But there is nothing in the deinition o oldr that mentions numbers, so oldr could work at contract (X X -> X) X ListOX -> X that is, you could use oldr at (Boolean Boolean) Boolean ListOBoolean -> Boolean or (Employee Employee) Employee ListOEmployee -> Employee 10

11 Let's watch oldr compute on this list cn y4 x4 x4 cn y3 x3 x3 cn y2 x2 x2 cn y1 x1 empty x1 val Step through the animation to watch the computation o (oldr cn val (list x4 x3 x2 x1)) 11

12 What can we learn rom this? The base value val is a possible 2 nd argument to cn. The result o cn becomes a 2 nd argument to cn. So this will work as long as val, the 2 nd argument to cn, and the result o cn are all o the same type. So cn must satisy the contract (X Y -> Y) or some X and Y. 12

13 What else can we learn? The elements o the list become the irst argument to cn. So i cn satisies the contract (X Y -> Y), then the list must be o type ListOX. So the contract or oldr is: oldr : (X Y -> Y) Y ListOX -> Y 13

14 The contract or oldr (again!) The contract or oldr is oldr : (X Y -> Y) Y ListOX -> Y So oldr takes 3 arguments: a combiner unction that satisies the contract (X Y -> Y) a base value o type Y and a list o X's. And it returns a value o type Y. 14

15 Another picture o oldr Here's another visualization o oldr that you may ind helpul. ( x1 x2 x3 x4 x5 ) val (oldr val (list x1... x5)) 15

16 What kind o data is on each arrow? x_i Y Y X Y 16

17 We can think o oldr as starting with the base value val, and putting it through a pipeline o 's, where each also takes one o the x's as an input. The x's are taken right-to-let, which is why it is called oldr. ( x1 x2 x3 x4 x5 ) val (oldr a (list x1... x5)) 17

18 Another example: ;; strategy: combine simpler unctions (deine (add1-i-true b n) (i b (+ n 1) n))) ;; strategy: Use HOF oldr on lob (deine (count-trues lob) (oldr add1-i-true 0 lob)) Or even better: ;; strategy: Use HOF oldr on lob (deine (count-trues lob) (local ((deine (add1-i-true b n) (i b (+ n 1) n))) (oldr add1-i-true 0 lob))) What is the contract or add1-i-true? At what contract is oldr being used in this example? What is returned by count-trues? Try to answer these questions beore proceeding to the next slide. 18

19 What are the contracts? add1-i-true : Boolean Number -> Number In general: oldr : (X Y -> Y) Y ListOX -> Y In this case, X = Boolean and Y = Number, so we are using oldr at the contract (Boolean Number -> Number) Number ListOBoolean -> Number and thereore count-trues : ListOBoolean -> Number 19

20 Local unctions need contracts and purpose statements too (deine (count-trues lob) (local (; add1-i-true : Boolean Number -> Number ; RETURNS: the number plus 1 i the boolean is ; true, otherwise returns the number unchanged. (deine (add1-i-true b n) (i b (+ n 1) n))) (oldr add1-i-true 0 lob))) They count as help unctions, so they don't need separate tests. Local unctions need their deliverables, too. They count as help unctions, so they don't need separate tests. I they are complicated enough to need examples or tests, then you should make them independent unctions with a ull set o deliverables. 20

21 The whole thing (less examples and tests) ;; count-trues : ListOBoolean -> Number ;; RETURNS: the number o trues in the given list o booleans. ;; STRATEGY: Use HOF oldr on lob (deine (count-trues lob) (local (; add1-i-true : Boolean Number -> Number ; RETURNS: the number plus 1 i the boolean is ; true, otherwise returns the number unchanged. (deine (add1-i-true b n) (i b (+ n 1) n))) (oldr add1-i-true 0 lob))) 21

22 Mapreduce (mapreduce v g lst) = (oldr v (map g lst)) Thereore: (mapreduce v g (list x1... xn)) = ( (g x1) ( (g x2) ( (g x3)... v))) You may have heard o mapreduce, which is used or processing large data sets. We can deine mapreduce using our unctions as shown here. 22

23 Why mapreduce wins One o the great things about mapreduce is that it can oten be computed in parallel. I is associative, and v is its identity, can turn the calls to into a tree and do them in parallel on a server arm! For a data set o size n, this reduces the processing time rom n to log(n). Here is a picture: 23

24 From linear time to logarithmic ( (g x1) ( (g x2) ( (g x3) ( (g x4) v)))) = g g g g x1 x2 x3 x4 24

25 Where does the data come rom? The data might not be a list. It might be data extracted rom a large database. So your application would have 2 parts some SQL to extract a table ull o data (like "map") the unction you want to reduce the data with. The SQL insulates your application rom the physical layout o the DB; the SQL query optimizer can probably get your data out o the DB ast. mapreduce systems (like Hadoop) allow you to conigure the 'reduce' phase to make use o the available hardware. 25

26 Summary You should now be able to: describe, recognize, and use the oldr pattern. state the contracts or ormap, andmap, and ilter and oldr, and use them appropriately. combine these unctions using higher-order unction combination. 26

27 Next Steps I you have questions about this lesson, ask them on the Discussion Board Do Guided Practice 5.4 Go on to the next lesson 27

ormap, andmap, and filter

ormap, andmap, and filter ormap, andmap, and filter CS 5010 Program Design Paradigms Bootcamp Lesson 6.3 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

More information

Rewriting your function using map and foldr

Rewriting your function using map and foldr Rewriting your function using map and foldr CS 5010 Program Design Paradigms Bootcamp Lesson 5.5 Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International

More information

Solving Your Problem by Generalization

Solving Your Problem by Generalization Solving Your Problem by Generalization CS 5010 Program Design Paradigms Lesson 7.1 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

More information

More About Recursive Data Types

More About Recursive Data Types More About Recursive Data Types CS 5010 Program Design Paradigms Bootcamp Lesson 5.5 Mitchell Wand, 2016-2017 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International

More information

From Templates to Folds

From Templates to Folds From Templates to Folds CS 5010 Program Design Paradigms Bootcamp Lesson 6.3 Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

More information

Halting Measures and Termination Arguments

Halting Measures and Termination Arguments Halting Measures and Termination Arguments CS 5010 Program Design Paradigms Bootcamp Lesson 8.2 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International

More information

Lists of Lists. CS 5010 Program Design Paradigms Bootcamp Lesson 5.3

Lists of Lists. CS 5010 Program Design Paradigms Bootcamp Lesson 5.3 Lists of Lists CS 5010 Program Design Paradigms Bootcamp Lesson 5.3 Mitchell Wand, 2012-2017 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Learning

More information

CS 135 Winter 2018 Tutorial 7: Accumulative Recursion and Binary Trees. CS 135 Winter 2018 Tutorial 7: Accumulative Recursion and Binary Trees 1

CS 135 Winter 2018 Tutorial 7: Accumulative Recursion and Binary Trees. CS 135 Winter 2018 Tutorial 7: Accumulative Recursion and Binary Trees 1 CS 135 Winter 2018 Tutorial 7: Accumulative Recursion and Binary Trees CS 135 Winter 2018 Tutorial 7: Accumulative Recursion and Binary Trees 1 Goals of this tutorial You should be able to... understand

More information

CS 5010 Program Design Paradigms Lesson 6.1

CS 5010 Program Design Paradigms Lesson 6.1 Lists vs. Structures CS 5010 Program Design Paradigms Lesson 6.1 Mitchell Wand, 2012-2016 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Module Introduction

More information

Lists. CS 5010 Program Design Paradigms Bootcamp Lesson 4.1

Lists. CS 5010 Program Design Paradigms Bootcamp Lesson 4.1 Lists CS 5010 Program Design Paradigms Bootcamp Lesson 4.1 Mitchell Wand, 2012-2017 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Module 04 Basic

More information

Lists of Lists. CS 5010 Program Design Paradigms Bootcamp Lesson 6.5

Lists of Lists. CS 5010 Program Design Paradigms Bootcamp Lesson 6.5 Lists of Lists CS 5010 Program Design Paradigms Bootcamp Lesson 6.5 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Learning

More information

Larger K-maps. So far we have only discussed 2 and 3-variable K-maps. We can now create a 4-variable map in the

Larger K-maps. So far we have only discussed 2 and 3-variable K-maps. We can now create a 4-variable map in the EET 3 Chapter 3 7/3/2 PAGE - 23 Larger K-maps The -variable K-map So ar we have only discussed 2 and 3-variable K-maps. We can now create a -variable map in the same way that we created the 3-variable

More information

Trees. CS 5010 Program Design Paradigms Bootcamp Lesson 5.1

Trees. CS 5010 Program Design Paradigms Bootcamp Lesson 5.1 Trees CS 5010 Program Design Paradigms Bootcamp Lesson 5.1 Mitchell Wand, 2012-2017 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Module 05 Basic

More information

Trees. CS 5010 Program Design Paradigms Lesson 6.2

Trees. CS 5010 Program Design Paradigms Lesson 6.2 Trees CS 5010 Program Design Paradigms Lesson 6.2 Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Introduction/Outline Many

More information

Case Study: Undefined Variables

Case Study: Undefined Variables Case Study: Undefined Variables CS 5010 Program Design Paradigms Bootcamp Lesson 7.4 Mitchell Wand, 2012-2017 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International

More information

9.8 Graphing Rational Functions

9.8 Graphing Rational Functions 9. Graphing Rational Functions Lets begin with a deinition. Deinition: Rational Function A rational unction is a unction o the orm P where P and Q are polynomials. Q An eample o a simple rational unction

More information

Types of recursion. Structural vs. general recursion. Pure structural recursion. Readings: none. In this module: learn to use accumulative recursion

Types of recursion. Structural vs. general recursion. Pure structural recursion. Readings: none. In this module: learn to use accumulative recursion Types of recursion Readings: none. In this module: learn to use accumulative recursion learn to recognize generative recursion CS 135 Fall 2018 07: Types of recursion 1 Structural vs. general recursion

More information

COMP 250 Fall graph traversal Nov. 15/16, 2017

COMP 250 Fall graph traversal Nov. 15/16, 2017 Graph traversal One problem we oten need to solve when working with graphs is to decide i there is a sequence o edges (a path) rom one vertex to another, or to ind such a sequence. There are various versions

More information

Types of recursion. Readings: none. In this module: a glimpse of non-structural recursion. CS 135 Winter : Types of recursion 1

Types of recursion. Readings: none. In this module: a glimpse of non-structural recursion. CS 135 Winter : Types of recursion 1 Types of recursion Readings: none. In this module: a glimpse of non-structural recursion CS 135 Winter 2018 07: Types of recursion 1 Structural vs. general recursion All of the recursion we have done to

More information

Binary recursion. Unate functions. If a cover C(f) is unate in xj, x, then f is unate in xj. x

Binary recursion. Unate functions. If a cover C(f) is unate in xj, x, then f is unate in xj. x Binary recursion Unate unctions! Theorem I a cover C() is unate in,, then is unate in.! Theorem I is unate in,, then every prime implicant o is unate in. Why are unate unctions so special?! Special Boolean

More information

Composite functions. [Type the document subtitle] Composite functions, working them out.

Composite functions. [Type the document subtitle] Composite functions, working them out. Composite unctions [Type the document subtitle] Composite unctions, workin them out. luxvis 11/19/01 Composite Functions What are they? In the real world, it is not uncommon or the output o one thin to

More information

Observer Templates. CS 5010 Program Design Paradigms Lesson 1.4

Observer Templates. CS 5010 Program Design Paradigms Lesson 1.4 Observer Templates CS 5010 Program Design Paradigms Lesson 1.4 Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Learning Objectives

More information

Using Inheritance to Share Implementations

Using Inheritance to Share Implementations Using Inheritance to Share Implementations CS 5010 Program Design Paradigms "Bootcamp" Lesson 11.2 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0

More information

Repetition Through Recursion

Repetition Through Recursion Fundamentals of Computer Science I (CS151.02 2007S) Repetition Through Recursion Summary: In many algorithms, you want to do things again and again and again. For example, you might want to do something

More information

Binary Search. CS 5010 Program Design Paradigms Bootcamp Lesson 8.2

Binary Search. CS 5010 Program Design Paradigms Bootcamp Lesson 8.2 Binary Search CS 5010 Program Design Paradigms Bootcamp Lesson 8.2 Mitchell Wand, 2012-2017 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Introduction

More information

Neighbourhood Operations

Neighbourhood Operations Neighbourhood Operations Neighbourhood operations simply operate on a larger neighbourhood o piels than point operations Origin Neighbourhoods are mostly a rectangle around a central piel Any size rectangle

More information

Math 1314 Lesson 24 Maxima and Minima of Functions of Several Variables

Math 1314 Lesson 24 Maxima and Minima of Functions of Several Variables Math 1314 Lesson 4 Maxima and Minima o Functions o Several Variables We learned to ind the maxima and minima o a unction o a single variable earlier in the course. We had a second derivative test to determine

More information

The Design Recipe Fall 2017

The Design Recipe Fall 2017 CS17 Integrated Introduction to Computer Science Hughes The Design Recipe Fall 2017 Contents 1 Design Recipe Steps 1 2 An OCaml Example 6 1 Design Recipe Steps This PDF outlines the steps to writing the

More information

Understanding Signal to Noise Ratio and Noise Spectral Density in high speed data converters

Understanding Signal to Noise Ratio and Noise Spectral Density in high speed data converters Understanding Signal to Noise Ratio and Noise Spectral Density in high speed data converters TIPL 4703 Presented by Ken Chan Prepared by Ken Chan 1 Table o Contents What is SNR Deinition o SNR Components

More information

Concavity. Notice the location of the tangents to each type of curve.

Concavity. Notice the location of the tangents to each type of curve. Concavity We ve seen how knowing where a unction is increasing and decreasing gives a us a good sense o the shape o its graph We can reine that sense o shape by determining which way the unction bends

More information

Chapter 3 Image Enhancement in the Spatial Domain

Chapter 3 Image Enhancement in the Spatial Domain Chapter 3 Image Enhancement in the Spatial Domain Yinghua He School o Computer Science and Technology Tianjin University Image enhancement approaches Spatial domain image plane itsel Spatial domain methods

More information

(add1 3) 4 (check-expect (add1 3) 4)

(add1 3) 4 (check-expect (add1 3) 4) (add1 3) 4 (check-expect (add1 3) 4) (define T 7) (define (q z) (sqr z)) (cond [(> T 3) (q 4)] [else 9]) (cond [(> T 3) (q 4)] [else 9]) -->[const] ^ (cond [(> 7 3) (q 4)] [else 9]) -->[arith] ^^^^^^^

More information

CSE 341 Section Handout #6 Cheat Sheet

CSE 341 Section Handout #6 Cheat Sheet Cheat Sheet Types numbers: integers (3, 802), reals (3.4), rationals (3/4), complex (2+3.4i) symbols: x, y, hello, r2d2 booleans: #t, #f strings: "hello", "how are you?" lists: (list 3 4 5) (list 98.5

More information

The λ-calculus. 1 Background on Computability. 2 Programming Paradigms and Functional Programming. 1.1 Alan Turing. 1.

The λ-calculus. 1 Background on Computability. 2 Programming Paradigms and Functional Programming. 1.1 Alan Turing. 1. The λ-calculus 1 Background on Computability The history o computability stretches back a long ways, but we ll start here with German mathematician David Hilbert in the 1920s. Hilbert proposed a grand

More information

Piecewise polynomial interpolation

Piecewise polynomial interpolation Chapter 2 Piecewise polynomial interpolation In ection.6., and in Lab, we learned that it is not a good idea to interpolate unctions by a highorder polynomials at equally spaced points. However, it transpires

More information

Case Study: Free Variables

Case Study: Free Variables Case Study: Free Variables CS 5010 Program Design Paradigms Bootcamp Lesson 7.3 Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

More information

2. Getting Started with the Graphical User Interface

2. Getting Started with the Graphical User Interface February 2011 NII52017-10.1.0 2. Getting Started with the Graphical User Interace NII52017-10.1.0 The Nios II Sotware Build Tools (SBT) or Eclipse is a set o plugins based on the popular Eclipse ramework

More information

How to Design Programs

How to Design Programs How to Design Programs How to (in Racket): represent data variants trees and lists write functions that process the data See also http://www.htdp.org/ 1 Running Example: GUIs Pick a fruit: Apple Banana

More information

Expression Values Operators. (string-append a b c ) a, b, c string-append. (substring abcd 0 2) abcd, 0, 2 substring

Expression Values Operators. (string-append a b c ) a, b, c string-append. (substring abcd 0 2) abcd, 0, 2 substring Expressions Expression Values perators (+ 2 3 5) 2 3 5 + (* 3.1 2.5) 3.1, 2.5 * (+ (* 3 2.2) 7) 7, 6.6 *, + (string-append a b c ) a, b, c string-append (circle 20 solid red ) 20, solid, red circle (substring

More information

6.001 SICP. Types. Types compound data. Types simple data. Types. Types procedures

6.001 SICP. Types. Types compound data. Types simple data. Types. Types procedures Today s topics Types of objects and procedures Procedural abstractions Capturing patterns across procedures Higher Order Procedures Types (+ 5 1) ==> 15 (+ "hi 5) ;The object "hi", passed as the first

More information

Compiler construction

Compiler construction This lecture Compiler construction Lecture 5: Project etensions Magnus Mreen Spring 2018 Chalmers Universit o Technolog Gothenburg Universit Some project etensions: Arras Pointers and structures Object-oriented

More information

The Design Recipe Fall 2018

The Design Recipe Fall 2018 CS17 Integrated Introduction to Computer Science Klein The Design Recipe Fall 2018 Contents 1 Design Recipe Steps 1 2 Another Racket Example 6 3 An OCaml Example 6 4 Another OCaml Example 8 1 Design Recipe

More information

CSc 520. Gofer III. Accumulative Recursion. Accumulative Recursion... Stack Recursion. Principles of Programming Languages. Christian Collberg

CSc 520. Gofer III. Accumulative Recursion. Accumulative Recursion... Stack Recursion. Principles of Programming Languages. Christian Collberg Slide 7 2 Accumulative Recursion We can sometimes get a more efficient solution by giving the function one extra argument, the accumulator, which is used to gather the final result. We will need to use

More information

Local definitions and lexical scope

Local definitions and lexical scope Local definitions and lexical scope Readings: HtDP, Intermezzo 3 (Section 18). Language level: Intermediate Student CS 135 Winter 2018 09: Local definitions and lexical scope 1 Local definitions The functions

More information

Local definitions and lexical scope. Local definitions. Motivating local definitions. s(s a)(s b)(s c), where s = (a + b + c)/2.

Local definitions and lexical scope. Local definitions. Motivating local definitions. s(s a)(s b)(s c), where s = (a + b + c)/2. Local definitions and lexical scope Readings: HtDP, Intermezzo 3 (Section 18). Language level: Intermediate Student CS 135 Winter 2018 09: Local definitions and lexical scope 1 Local definitions The functions

More information

CS 161: Design and Analysis of Algorithms

CS 161: Design and Analysis of Algorithms CS 161: Design and Analysis o Algorithms Announcements Homework 3, problem 3 removed Greedy Algorithms 4: Human Encoding/Set Cover Human Encoding Set Cover Alphabets and Strings Alphabet = inite set o

More information

Module 8: Local and functional abstraction

Module 8: Local and functional abstraction Module 8: Local and functional abstraction Readings: HtDP, Intermezzo 3 (Section 18); Sections 19-23. We will cover material on functional abstraction in a somewhat different order than the text. We will

More information

ROBUST FACE DETECTION UNDER CHALLENGES OF ROTATION, POSE AND OCCLUSION

ROBUST FACE DETECTION UNDER CHALLENGES OF ROTATION, POSE AND OCCLUSION ROBUST FACE DETECTION UNDER CHALLENGES OF ROTATION, POSE AND OCCLUSION Phuong-Trinh Pham-Ngoc, Quang-Linh Huynh Department o Biomedical Engineering, Faculty o Applied Science, Hochiminh University o Technology,

More information

Decision Support Systems for E-Purchasing using Case-Based Reasoning and Rating Based Collaborative Filtering

Decision Support Systems for E-Purchasing using Case-Based Reasoning and Rating Based Collaborative Filtering Decision Support Systems or E-Purchasing using Case-Based Reasoning and Rating Based Collaborative Filtering ABSTRACT The amount o trade conducted electronically has grown dramatically since the wide introduction

More information

The λ-calculus. 1 Background on Computability. 2 Some Intuition for the λ-calculus. 1.1 Alan Turing. 1.2 Alonzo Church

The λ-calculus. 1 Background on Computability. 2 Some Intuition for the λ-calculus. 1.1 Alan Turing. 1.2 Alonzo Church The λ-calculus 1 Background on Computability The history o computability stretches back a long ways, but we ll start here with German mathematician David Hilbert in the 1920s. Hilbert proposed a grand

More information

Some Inequalities Involving Fuzzy Complex Numbers

Some Inequalities Involving Fuzzy Complex Numbers Theory Applications o Mathematics & Computer Science 4 1 014 106 113 Some Inequalities Involving Fuzzy Complex Numbers Sanjib Kumar Datta a,, Tanmay Biswas b, Samten Tamang a a Department o Mathematics,

More information

Contracts, Purpose Statements, Examples and Tests

Contracts, Purpose Statements, Examples and Tests Contracts, Purpose Statements, Examples and Tests CS 5010 Program Design Paradigms Bootcamp Lesson 2.1 Mitchell Wand, 2012-2017 This work is licensed under a Creative Commons Attribution-NonCommercial

More information

Administrivia. Simple data types

Administrivia. Simple data types Administrivia Lists, higher order procedures, and symbols 6.037 - Structure and Interpretation of Computer Programs Mike Phillips (mpp) Massachusetts Institute of Technology Project 0 was due today Reminder:

More information

9.3 Transform Graphs of Linear Functions Use this blank page to compile the most important things you want to remember for cycle 9.

9.3 Transform Graphs of Linear Functions Use this blank page to compile the most important things you want to remember for cycle 9. 9. Transorm Graphs o Linear Functions Use this blank page to compile the most important things you want to remember or cycle 9.: Sec Math In-Sync by Jordan School District, Utah is licensed under a 6 Function

More information

Generell Topologi. Richard Williamson. May 6, 2013

Generell Topologi. Richard Williamson. May 6, 2013 Generell Topologi Richard Williamson May 6, Thursday 7th January. Basis o a topological space generating a topology with a speciied basis standard topology on R examples Deinition.. Let (, O) be a topological

More information

A Proposed Approach for Solving Rough Bi-Level. Programming Problems by Genetic Algorithm

A Proposed Approach for Solving Rough Bi-Level. Programming Problems by Genetic Algorithm Int J Contemp Math Sciences, Vol 6, 0, no 0, 45 465 A Proposed Approach or Solving Rough Bi-Level Programming Problems by Genetic Algorithm M S Osman Department o Basic Science, Higher Technological Institute

More information

CS115 INTRODUCTION TO COMPUTER SCIENCE 1. Additional Notes Module 5

CS115 INTRODUCTION TO COMPUTER SCIENCE 1. Additional Notes Module 5 CS115 INTRODUCTION TO COMPUTER SCIENCE 1 Additional Notes Module 5 Example my-length (Slide 17) 2 (define (my-length alos) [(empty? alos) 0] [else (+ 1 (my-length (rest alos)))])) (my-length empty) alos

More information

CS3: Introduction to Symbolic Programming. Lecture 14: Lists.

CS3: Introduction to Symbolic Programming. Lecture 14: Lists. CS3: Introduction to Symbolic Programming Lecture 14: Lists Fall 2006 Nate Titterton nate@berkeley.edu Schedule 13 14 15 16 April 16-20 April 23-27 Apr 30-May 4 May 7 Thursday, May 17 Lecture: CS3 Projects,

More information

Basics of Inheritance

Basics of Inheritance Basics of Inheritance CS 5010 Program Design Paradigms "Bootcamp" Lesson 11.1 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

More information

Doing it in Java. CS 5010 Program Design Paradigms Bootcamp Lesson 5.4

Doing it in Java. CS 5010 Program Design Paradigms Bootcamp Lesson 5.4 Doing it in Java CS 5010 Program Design Paradigms Bootcamp Lesson 5.4 Mitchell Wand and William Clinger, 2012-2017 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International

More information

Design and Realization of user Behaviors Recommendation System Based on Association rules under Cloud Environment

Design and Realization of user Behaviors Recommendation System Based on Association rules under Cloud Environment Research Journal o Applied Sciences, Engineering and Technology 6(9): 1669-1673, 2013 ISSN: 2040-7459; e-issn: 2040-7467 Maxwell Scientiic Organization, 2013 Submitted: January 19, 2013 Accepted: March

More information

Working with images and scenes

Working with images and scenes Working with images and scenes CS 5010 Program Design Paradigms Bootcamp Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Lesson

More information

Computer Data Analysis and Plotting

Computer Data Analysis and Plotting Phys 122 February 6, 2006 quark%//~bland/docs/manuals/ph122/pcintro/pcintro.doc Computer Data Analysis and Plotting In this lab we will use Microsot EXCEL to do our calculations. This program has been

More information

2. Design Planning with the Quartus II Software

2. Design Planning with the Quartus II Software November 2013 QII51016-13.1.0 2. Design Planning with the Quartus II Sotware QII51016-13.1.0 This chapter discusses key FPGA design planning considerations, provides recommendations, and describes various

More information

MAPI Computer Vision. Multiple View Geometry

MAPI Computer Vision. Multiple View Geometry MAPI Computer Vision Multiple View Geometry Geometry o Multiple Views 2- and 3- view geometry p p Kpˆ [ K R t]p Geometry o Multiple Views 2- and 3- view geometry Epipolar Geometry The epipolar geometry

More information

Automated Planning for Feature Model Configuration based on Functional and Non-Functional Requirements

Automated Planning for Feature Model Configuration based on Functional and Non-Functional Requirements Automated Planning or Feature Model Coniguration based on Functional and Non-Functional Requirements Samaneh Soltani 1, Mohsen Asadi 1, Dragan Gašević 2, Marek Hatala 1, Ebrahim Bagheri 2 1 Simon Fraser

More information

CS485/685 Computer Vision Spring 2012 Dr. George Bebis Programming Assignment 2 Due Date: 3/27/2012

CS485/685 Computer Vision Spring 2012 Dr. George Bebis Programming Assignment 2 Due Date: 3/27/2012 CS8/68 Computer Vision Spring 0 Dr. George Bebis Programming Assignment Due Date: /7/0 In this assignment, you will implement an algorithm or normalizing ace image using SVD. Face normalization is a required

More information

Global Constraints. Combinatorial Problem Solving (CPS) Enric Rodríguez-Carbonell (based on materials by Javier Larrosa) February 22, 2019

Global Constraints. Combinatorial Problem Solving (CPS) Enric Rodríguez-Carbonell (based on materials by Javier Larrosa) February 22, 2019 Global Constraints Combinatorial Problem Solving (CPS) Enric Rodríguez-Carbonell (based on materials by Javier Larrosa) February 22, 2019 Global Constraints Global constraints are classes o constraints

More information

Typed Scheme: Scheme with Static Types

Typed Scheme: Scheme with Static Types Typed Scheme: Scheme with Static Types Version 4.1.1 Sam Tobin-Hochstadt October 5, 2008 Typed Scheme is a Scheme-like language, with a type system that supports common Scheme programming idioms. Explicit

More information

Skill Sets Chapter 5 Functions

Skill Sets Chapter 5 Functions Skill Sets Chapter 5 Functions No. Skills Examples o questions involving the skills. Sketch the graph o the (Lecture Notes Example (b)) unction according to the g : x x x, domain. x, x - Students tend

More information

Model-View-Controller Architecture

Model-View-Controller Architecture Model-View-Controller Architecture CS 5010 Program Design Paradigms Bootcamp Lesson 11.3 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International

More information

6.001 Notes: Section 8.1

6.001 Notes: Section 8.1 6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything

More information

Procedural abstraction SICP Data abstractions. The universe of procedures forsqrt. Procedural abstraction example: sqrt

Procedural abstraction SICP Data abstractions. The universe of procedures forsqrt. Procedural abstraction example: sqrt Data abstractions Abstractions and their variations Basic data abstractions Why data abstractions are useful Procedural abstraction Process of procedural abstraction Define formal parameters, capture process

More information

The purpose of this lesson is to familiarize you with the basics of Racket (a dialect of Scheme). You will learn about

The purpose of this lesson is to familiarize you with the basics of Racket (a dialect of Scheme). You will learn about Lesson 0.4 Introduction to Racket Preliminaries The purpose of this lesson is to familiarize you with the basics of Racket (a dialect of Scheme). You will learn about Expressions Numbers, Booleans, and

More information

Status. We ll do code generation first... Outline

Status. We ll do code generation first... Outline Status Run-time Environments Lecture 11 We have covered the ront-end phases Lexical analysis Parsin Semantic analysis Next are the back-end phases Optimization Code eneration We ll do code eneration irst...

More information

THE FINANCIAL CALCULATOR

THE FINANCIAL CALCULATOR Starter Kit CHAPTER 3 Stalla Seminars THE FINANCIAL CALCULATOR In accordance with the AIMR calculator policy in eect at the time o this writing, CFA candidates are permitted to use one o two approved calculators

More information

Working with recursion. From definition to template. Readings: HtDP, sections 11, 12, 13 (Intermezzo 2).

Working with recursion. From definition to template. Readings: HtDP, sections 11, 12, 13 (Intermezzo 2). Working with recursion Readings: HtDP, sections 11, 12, 13 (Intermezzo 2). We can extend the idea of a self-referential definition to defining the natural numbers, which leads to the use of recursion in

More information

Working with recursion

Working with recursion Working with recursion Readings: HtDP, sections 11, 12, 13 (Intermezzo 2). We can extend the idea of a self-referential definition to defining the natural numbers, which leads to the use of recursion in

More information

Introduction to Scratch Programming v1.4 (Second Ed) Lesson 6 Calculator

Introduction to Scratch Programming v1.4 (Second Ed) Lesson 6 Calculator Lesson What you will learn: how to perform simple calculations using Scratch how to use variables how to develop a design how to use the else if function how to create animated buttons Contents Exercise

More information

Proceedings of the Sixth International Workshop on Graph Transformation and Visual Modeling Techniques (GT-VMT 2007)

Proceedings of the Sixth International Workshop on Graph Transformation and Visual Modeling Techniques (GT-VMT 2007) Electronic Communications o the EASST Volume X (2007) Proceedings o the Sixth International Workshop on Graph Transormation and Visual Modeling Techniques (GT-VMT 2007) Visual Programming with Recursion

More information

The Data Design Recipe

The Data Design Recipe The Data Design Recipe CS 5010 Program Design Paradigms Bootcamp Lesson 1.3 Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

More information

CS115 - Module 9 - filter, map, and friends

CS115 - Module 9 - filter, map, and friends Fall 2017 Reminder: if you have not already, ensure you: Read How to Design Programs, Intermezzo 3 (Section 18); Sections 19-23. Abstraction abstraction, n. 3a.... The process of isolating properties or

More information

Computer Data Analysis and Use of Excel

Computer Data Analysis and Use of Excel Computer Data Analysis and Use o Excel I. Theory In this lab we will use Microsot EXCEL to do our calculations and error analysis. This program was written primarily or use by the business community, so

More information

Automatic Video Segmentation for Czech TV Broadcast Transcription

Automatic Video Segmentation for Czech TV Broadcast Transcription Automatic Video Segmentation or Czech TV Broadcast Transcription Jose Chaloupka Laboratory o Computer Speech Processing, Institute o Inormation Technology and Electronics Technical University o Liberec

More information

Lazy evaluation. Lazy evaluation (3) Lazy evaluation (2) Lazy execution. Example. Declarative Concurrency. Lazy Execution (VRH 4.

Lazy evaluation. Lazy evaluation (3) Lazy evaluation (2) Lazy execution. Example. Declarative Concurrency. Lazy Execution (VRH 4. Declarative Concurrency Lazy Execution (VRH 4.5) Carlos Varela RPI Lazy evaluation The deault unctions in Oz are evaluated eagerly (as soon as they are called) Another way is lazy evaluation where a computation

More information

1-2. Composition of Functions. OBJECTIVES Perform operations with functions. Find composite functions. Iterate functions using real numbers.

1-2. Composition of Functions. OBJECTIVES Perform operations with functions. Find composite functions. Iterate functions using real numbers. - OBJECTIVES Perorm operations with unctions. Find composite unctions. Iterate unctions using real numbers. Composition o Functions BUSINESS Each year, thousands o people visit Yellowstone National Park

More information

Laboratory: Recursion Basics

Laboratory: Recursion Basics Fundamentals of Computer Science I: Media Computing (CS151.02 2007F) Laboratory: Recursion Basics Summary: In this laboratory, you will explore some basic concepts in recursing over lists. Contents: Preparation

More information

Programming Languages. Function-Closure Idioms. Adapted from Dan Grossman's PL class, U. of Washington

Programming Languages. Function-Closure Idioms. Adapted from Dan Grossman's PL class, U. of Washington Programming Languages Function-Closure Idioms Adapted from Dan Grossman's PL class, U. of Washington More idioms We know the rule for lexical scope and function closures Now what is it good for A partial

More information

Proceedings of HotOS IX: The 9th Workshop on Hot Topics in Operating Systems

Proceedings of HotOS IX: The 9th Workshop on Hot Topics in Operating Systems USENIX Association Proceedings o HotOS IX: The 9th Workshop on Hot Topics in Operating Systems Lihue, Hawaii, USA May 18 21, 2003 THE ADVANCED COMPUTING SYSTEMS ASSOCIATION 2003 by The USENIX Association

More information

A Classification System and Analysis for Aspect-Oriented Programs

A Classification System and Analysis for Aspect-Oriented Programs A Classiication System and Analysis or Aspect-Oriented Programs Martin Rinard, Alexandru Sălcianu, and Suhabe Bugrara Massachusetts Institute o Technology Cambridge, MA 02139 ABSTRACT We present a new

More information

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G.

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G. Scheme: Data CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks ggchappell@alaska.edu

More information

MATRIX ALGORITHM OF SOLVING GRAPH CUTTING PROBLEM

MATRIX ALGORITHM OF SOLVING GRAPH CUTTING PROBLEM UDC 681.3.06 MATRIX ALGORITHM OF SOLVING GRAPH CUTTING PROBLEM V.K. Pogrebnoy TPU Institute «Cybernetic centre» E-mail: vk@ad.cctpu.edu.ru Matrix algorithm o solving graph cutting problem has been suggested.

More information

First Video Streaming Experiments on a Time Driven Priority Network

First Video Streaming Experiments on a Time Driven Priority Network First Video Streaming Experiments on a Driven Priority Network Mario Baldi and Guido Marchetto Department o Control and Computer Engineering Politecnico di Torino (Technical University o Torino) Abstract

More information

Learning Implied Global Constraints

Learning Implied Global Constraints Learning Implied Global Constraints Christian Bessiere LIRMM-CNRS U. Montpellier, France bessiere@lirmm.r Remi Coletta LRD Montpellier, France coletta@l-rd.r Thierry Petit LINA-CNRS École des Mines de

More information

Scheduling in Multihop Wireless Networks without Back-pressure

Scheduling in Multihop Wireless Networks without Back-pressure Forty-Eighth Annual Allerton Conerence Allerton House, UIUC, Illinois, USA September 29 - October 1, 2010 Scheduling in Multihop Wireless Networks without Back-pressure Shihuan Liu, Eylem Ekici, and Lei

More information

Case by Case. Chapter 3

Case by Case. Chapter 3 Chapter 3 Case by Case In the previous chapter, we used the conditional expression if... then... else to define functions whose results depend on their arguments. For some of them we had to nest the conditional

More information

Generative and accumulative recursion. What is generative recursion? Example revisited: GCD. Readings: Sections 25, 26, 27, 30, 31

Generative and accumulative recursion. What is generative recursion? Example revisited: GCD. Readings: Sections 25, 26, 27, 30, 31 Generative and accumulative recursion Readings: Sections 25, 26, 27, 30, 31 Some subsections not explicitly covered in lecture Section 27.2 technique applied to strings CS 135 Fall 2017 11: Generative

More information

Querying Complex Spatio-Temporal Sequences in Human Motion Databases

Querying Complex Spatio-Temporal Sequences in Human Motion Databases Querying Complex Spatio-Temporal Sequences in Human Motion Databases Yueguo Chen #, Shouxu Jiang, Beng Chin Ooi #, Anthony KH Tung # # School o Computing, National University o Singapore Computing, Law

More information

Section II. Nios II Software Development

Section II. Nios II Software Development Section II. Nios II Sotware Development This section o the Embedded Design Handbook describes how to most eectively use the Altera tools or embedded system sotware development, and recommends design styles

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 17: Functional Programming Zheng (Eddy Zhang Rutgers University April 4, 2018 Class Information Homework 6 will be posted later today. All test cases

More information