Functional Programming

Slides:



Advertisements
Similar presentations
Functional Programming Languages Session 12
Advertisements

1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 14 Functional Programming Languages - The design of the imperative languages is based directly.
1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
Lambda Calculus and Lisp PZ03J. Lambda Calculus The lambda calculus is a model for functional programming like Turing machines are models for imperative.
CS 355 – PROGRAMMING LANGUAGES Dr. X. Apply-to-all A functional form that takes a single function as a parameter and yields a list of values obtained.
1-1 An Introduction to Scheme March Introduction A mid-1970s dialect of LISP, designed to be a cleaner, more modern, and simpler version than.
1 Functional programming Languages And a brief introduction to Lisp and Scheme.
Functional Programming Languages
Chapter 15 Other Functional Languages. Copyright © 2007 Addison-Wesley. All rights reserved. Functional Languages Scheme and LISP have a simple syntax.
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
Chapter 15 Functional Programming Languages. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Introduction Design of imperative languages is.
ISBN Chapter 15 Functional Programming Languages Mathematical Functions Fundamentals of Functional Programming Languages Introduction to.
ISBN Chapter 15 Functional Programming Languages.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
ISBN Chapter 15 Functional Programming Languages.
Dr. Muhammed Al-Mulhem ICS An Introduction to Functional Programming.
1 Lisp and Functional Languages Functional forms Referential transparency Function construction Function composition Mapping functions Designing functional.
CS 355 – Programming Languages
The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. from Concepts of Programming Languages, 9th edition by Robert W. Sebesta,
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
LISP – Not just a Speech Impediment Jim Lowe. Brief History of LISP Initial development begins at the Dartmouth Summer Research Project in 1956 by Dr.
1 Functional Programming In Text: Chapter Chapter 2: Evolution of the Major Programming Languages Outline Functional programming (FP) basics A bit.
 The design of the imperative languages is based directly on the von Neumann architecture  Efficiency is the primary concern  Low-level specifications:
CS 152: Programming Language Paradigms February 10 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
ISBN Chapter 15 Functional Programming Languages.
Functional Programming Languages Chapter 14
ISBN Chapter 15 Functional Programming Languages.
1 Programming Languages and Paradigms Functional Programming.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Functional Programming Universitatea Politehnica Bucuresti Adina Magda Florea
CHAPTER 15 & 16 Functional & Logic Programming Languages.
ISBN Chapter 15 Functional Programming Languages.
CS 363 Comparative Programming Languages Functional Languages: Scheme.
Comparative Programming Languages Language Comparison: Scheme, Smalltalk, Python, Ruby, Perl, Prolog, ML, C++/STL, Java, Haskell.
ISBN Chapter 15 Functional Programming Languages.
ISBN Chapter 15 Functional Programming Languages.
ISBN Chapter 15 Functional Programming Languages.
1 Chapter 15 © 2002 by Addison Wesley Longman, Inc Introduction - The design of the imperative languages is based directly on the von Neumann architecture.
ISBN Chapter 15 Functional Programming Languages.
TIVDM2Functional Programming Language Concepts 1 Concepts from Functional Programming Languages Peter Gorm Larsen.
1-1 An Introduction to Functional Programming Sept
1 Scheme (Section 11.2) CSCI 431 Programming Languages Fall 2003.
1 FP Foundations, Scheme In Text: Chapter Chapter 14: FP Foundations, Scheme Mathematical Functions Def: A mathematical function is a mapping of.
Functional Programming Part 1. Organization of Programming Languages-Cheng Big Picture u What we’ve learned so far: Imperative Programming Languages 
ISBN Chapter 15 Functional Programming Languages.
CSE 425: Functional Programming I Programs as Functions Some programs act like mathematical functions –Associate a set of input values from the function’s.
Comparative Programming Languages Functional programming with Lisp/Scheme.
ISBN Chapter 15 Functional Programming Languages.
Functional Programming
Functional Programming
Functional Programming Languages
Functional Programming Languages
Functional Programming Languages
Chapter 15 :Functional Programming Languages
Functional Programming Languages
Functional Programming
History of Computing – Lisp
CS 3304 Comparative Languages
Functional Programming Languages
Fundamentals of Functional Programming Languages
Chapter 15 Functional Programming Languages
FP Foundations, Scheme In Text: Chapter 14.
Functional Programming Languages
Programming Languages 2nd edition Tucker and Noonan
Functional Programming Languages
15.2 Mathematical Functions
Chapter 15 Functional Programming 6/1/2019.
Functional Programming Languages
Presentation transcript:

Functional Programming In Text: Chapter 15

 Chapter 15: Functional Programming  Outline Functional programming (FP) basics A bit of LISP Mathematical functions, functional forms Scheme language overview Brief mention of Common LISP, ML, Haskell Common Applications  Chapter 15: Functional Programming 

 Chapter 15: Functional Programming  The Basis for FP Imperative language design is based directly on the von Neumann architecture Efficiency is often of primary concern, rather than suitability for software development The design of functional languages is based on mathematical functions: A solid theoretical basis Closer to the user Relatively unconcerned with the machine architecture  Chapter 15: Functional Programming 

Fundamentals of FP Languages The objective: mimic mathematical functions to the greatest extent possible The basic process of computation is fundamentally different than in an imperative language In an imperative language: Operations are done, results are stored in variables for later use Mgmt. of variables is a constant concern, source of complexity In an FPL: Variables are not necessary, as is the case in mathematics a function always produces the same result given the same parameters (referential transparency)  Chapter 15: Functional Programming 

 Chapter 15: Functional Programming  A Bit of LISP The first functional programming language Originally a typeless language Only two data types: atom and list LISP lists are stored internally as single-linked lists Lambda notation is used to specify functions The first LISP interpreter intended to show computational capabilities  Chapter 15: Functional Programming 

 Chapter 15: Functional Programming  A Bit of Scheme A mid-1970s dialect of LISP, designed to be cleaner, more modern, and simpler version than the contemporary dialects of LISP Uses only static scoping Functions are first-class entities They can be the values of expressions and elements of lists They can be assigned to variables and passed as parameters  Chapter 15: Functional Programming 

 Chapter 15: Functional Programming  Program  Data Function definitions, function applications, and data all have the same form Consider this S-expression: (A B C) As data: it is a simple list of three atoms: A, B, and C As a function application: it means that the function named A is applied to the two parameters, B and C It would be a function definition if the first element were the atom “define” instead of “A”  Chapter 15: Functional Programming 

Applications of Functional Languages: APL is used for throw-away programs LISP is used for artificial intelligence Knowledge representation Machine learning Natural language processing Modeling of speech and vision Scheme is used to teach introductory programming at a significant number of universities  Chapter 15: Functional Programming 

Comparing Functional and Imperative Languages Efficient execution Complex semantics Complex syntax Concurrency is programmer designed Functional Languages: Simple semantics Simple syntax Inefficient execution Programs can automatically be made concurrent  Chapter 15: Functional Programming 