Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
115 views

PCPD Functional Programming PDF

The document provides an introduction to declarative programming and functional programming concepts including lambda calculus. It defines lambda calculus as a formal system for expressing computation based on function abstraction and application using variable binding and substitution. Examples are provided to demonstrate lambda abstraction, substitution, free and bound variables. Functional programming languages that support lambda calculus like Lisp, Haskell and ADA are mentioned.

Uploaded by

Pravin Shinde
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views

PCPD Functional Programming PDF

The document provides an introduction to declarative programming and functional programming concepts including lambda calculus. It defines lambda calculus as a formal system for expressing computation based on function abstraction and application using variable binding and substitution. Examples are provided to demonstrate lambda abstraction, substitution, free and bound variables. Functional programming languages that support lambda calculus like Lisp, Haskell and ADA are mentioned.

Uploaded by

Pravin Shinde
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Module 3

Declarative Programming Paradigm: Functional


Programming
Introduction to Lambda Calculus, Functional Programming Concepts,
Evaluation order, Higher order functions, I/O- Streams and Monads.

Self-learning Topics: Implementation of I/O using any programming language.

Declarative programming is a programming


paradigm … that expresses the logic of a computation
without describing its control flow.

Imperative programming is a programming


paradigm that uses statements that change a program’s
state.

Functional Programming Languages:


- The design of the imperative languages is based directly on the von Neumann architecture
- Efficiency is the primary concern, rather than the suitability of the language for software
development.
- The design of the functional languages is based on mathematical functions
- A solid theoretical basis that is also closer to the user, but relatively unconcerned with the
architecture of the machines on which programs will run
Mathematical Functions:
Def: A mathematical function is a mapping of members of one set, called the domain set, to another
set,
called the range set.

F(x)=x%2
X={2,3,4,5,6,7} r=(0,1)

2 0

3 1

Lambda Calculus

The lambda calculus was introduced by mathematician Alonzo Church in the 1930s as part
of an investigation into the foundations of mathematics. Lambda calculus is a formal system in
mathematical logic for expressing computation based on function abstraction and application
using variable binding and substitution.

e.g Expression

F(x)= x%2

Parameter

Parameter

Lambda Abstraction
x.x+1

Expression

Function Signifier

x x%2

(lambda hide working process and gives only result)


e.g 2

F(x,y)=x*y

x. y.x*y x x*y

y
 Substitution
F(x)=x*1 f(3)= x*1 3

x. x*1 ( x.x*1)2  x*1=3

 Need of Lambda
It is Universal mode of computation which can be encode anything.

Functional Programming language that supports lambda calculus are


LISP, Haskell, ADA etc.

Everything is in the form of function only get more abstraction.

Help us to increase our understanding of computation.

 Syntax
1. Variable  E::= x Parameter
2. Function Creation  x. E Expression
3. Function Application
E1,E2
Where E1 is calling function with argument E2.

 Free and Bound Variables


Values are going to substituted for bounded variable only and not for free variable.
x. x+y
Free Variable
Bounded
Veriable

E.g
( x. x+y) 3  3+y

e.g 2 Two variables

((( x. y. x+y+z)3 ) 4)

( y. 3+y+z)4
3+4+z 7+z

You might also like