Functional Design and Programming Lecture 6: Functions as data.

Slides:



Advertisements
Similar presentations
Cs776(Prasad)L7fold1 Fold Operations Abstracting Repetitions.
Advertisements

Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
Comp 205: Comparative Programming Languages Higher-Order Functions Functions of functions Higher-order functions on lists Reuse Lecture notes, exercises,
CSE 341 Lecture 16 More Scheme: lists; helpers; let/let*; higher-order functions; lambdas slides created by Marty Stepp
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Blind Search by Prof. Jean-Claude Latombe
Algorithms and Data Structures
SE Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited.
1 Tree Searching Strategies Updated: 2010/12/27. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these.
1 Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3–5.
Lecture 16: Tree Traversal.
Lesson 2-5 Example Use a factor tree to write the numerator as a product of prime numbers. Example = 2 ● 2 ● 2 ● 3.
CPSC 322 Introduction to Artificial Intelligence October 27, 2004.
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
Midterm 2 Overview Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Functional Design and Programming Lecture 1: Functional modeling, design and programming.
0 PROGRAMMING IN HASKELL Chapter 7 - Higher-Order Functions.
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
Artificial Intelligence Chapter 3: Solving Problems by Searching
1 Solving Problems by Searching. 2 Terminology State State Space Initial State Goal Test Action Step Cost Path Cost State Change Function State-Space.
Functional Design and Programming Lecture 3: List processing.
Functional Design and Programming Lecture 4: Sorting.
Using Search in Problem Solving
CSC344: AI for Games Lecture 4: Informed search
Comp 205: Comparative Programming Languages Lazy Evaluation Errors Evaluation Strategies Infinite Lists…. Lecture notes, exercises, etc., can be found.
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
Copyright R. Weber Search in Problem Solving ISYS 370 Dr. R. Weber.
Math 71B 11.1 – Sequences and Summation Notation 1.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l all learning algorithms,
Advanced Functional Programming 2009 Ulf Norell (lecture by Jean-Philippe Bernardy)
Artificial Intelligence LECTURE 4 ARTIFICIAL INTELLIGENCE LECTURES BY ENGR. QAZI ZIA.
Vilalta&Eick:Uninformed Search Problem Solving By Searching Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States/Looping.
CS 603: Programming Language Organization Lecture 10 Spring 2004 Department of Computer Science University of Alabama Joel Jones.
A Third Look At ML Chapter NineModern Programming Languages, 2nd ed.1.
Lee CSCE 314 TAMU 1 CSCE 314 Programming Languages Haskell: Higher-order Functions Dr. Hyunyoung Lee.
Artificial Intelligence for Games Informed Search (2) Patrick Olivier
CSC3203: AI for Games Informed search (1) Patrick Olivier
Basic Search Procedure 1. Start with the start node (root of the search tree) and place in on the queue 2. Remove the front node in the queue and If the.
1 CS 457/557: Functional Languages Lists and Algebraic Datatypes Mark P Jones Portland State University.
Slides by: Eric Ringger, adapted from slides by Stuart Russell of UC Berkeley. CS 312: Algorithm Design & Analysis Lecture #36: Best-first State- space.
CS 603: Programming Language Organization Lecture 9 Spring 2003 Department of Computer Science University of Alabama Joel Jones.
1 Programming Languages (CS 550) Lecture 4 Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
Local Search. Systematic versus local search u Systematic search  Breadth-first, depth-first, IDDFS, A*, IDA*, etc  Keep one or more paths in memory.
Implementation: General Tree Search
3.5 Informed (Heuristic) Searches This section show how an informed search strategy can find solution more efficiently than uninformed strategy. Best-first.
Recursion Higher Order Functions CSCE 314 Spring 2016.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
Haskell Chapter 5, Part II. Topics  Review/More Higher Order Functions  Lambda functions  Folds.
CSE 341 Lecture 8 curried functions Ullman 5.5 slides created by Marty Stepp
Web Crawling and Automatic Discovery Donna Bergmark March 14, 2002.
Search Part I Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States Partial Information Summary.
1 CSE1301 Computer Programming: Where are we now in the CSE1301 syllabus?
CSE 3302 Programming Languages Chengkai Li Spring 2008 Functional Programming Language: Haskell (cont’d) Lecture 20 – Functional Programming, Spring 2008.
PROGRAMMING IN HASKELL
PROGRAMMING IN HASKELL
2.6 Applications Of Induction & other ideas Important Theorems
CS-401 Computer Architecture & Assembly Language Programming
Prime Factorization Practice
Higher Order Functions
CS 457/557: Functional Languages Folds
HIGHER ORDER FUNCTIONS
Computer Science 312 Composing Functions Streams in Java 1.
PROGRAMMING IN HASKELL
foldr and foldl applied to addition (using infix notation)
With thanks to Alexander Lent, Nick Mooney, Spencer Pearson
GC16/3011 Functional Programming Lecture 9 Higher Order Functions
RANDOM NUMBERS SET # 1:
Presentation transcript:

Functional Design and Programming Lecture 6: Functions as data

Literature (Pensum)  Paulson, chap. 5: Functions as values ( ) Standard combinators List combinators ( ) Other combinators (5.11) Infinite lists ( ) Search strategies and infinite lists ( )

Exercises  Paulson, chap. 5:

Overview  Functions as values  Standard combinators List combinators Other combinators  Infinite lists  Search strategies and infinite lists

Functions as values  Lambda-notation (anonymous functions)  Currying and uncurring  Functions in data structures  Functions as arguments and results

Lambda-notation

Currying and uncurrying

Functions in data structures  Example: Mapping keywords to comparison functions (for sorting)

Functions as arguments and results  Examples: Lookup function for comparison functions parameterized sort function Summation

Standard combinators  List combinators: map, filter takewhile, dropwhile exists, all foldl, foldr  Other combinators: compose ( o ) repeat treefold

Infinite lists (sequences)  Datatypes for delayed evaluation  Elementary sequence processing  Elementary applications of sequences: Random numbers Prime numbers Numerical computing

Search strategies  Infinite trees  Search strategies for infinite trees: depth-first breadth-first depth-first iterative best-first  Toy applications: palindromes 8-queens