0% found this document useful (0 votes)
6 views4 pages

Functional Programming

Functional programming languages (FPL) are designed for symbolic computation and list processing, focusing on functionality rather than memory management. They are primarily used in AI applications and include languages like Lisp, Scheme, and Haskell. The document discusses definitions, applications, characteristics, and examples of FPL, including comparisons with imperative programming languages.

Uploaded by

lijaf37417
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Functional Programming

Functional programming languages (FPL) are designed for symbolic computation and list processing, focusing on functionality rather than memory management. They are primarily used in AI applications and include languages like Lisp, Scheme, and Haskell. The document discusses definitions, applications, characteristics, and examples of FPL, including comparisons with imperative programming languages.

Uploaded by

lijaf37417
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Functional Programming Languages (FPL)

1. Definitions .................................................................. 3
2. Applications ................................................................ 3
3. Examples .................................................................... 4
4. FPL Characteristics:.................................................... 5
5. Lambda calculus (LC) ................................................ 6
5.1. LC expressions forms ......................................... 6
5.2. Semantic of Functional Computations: ............... 8
5.3. Python Lambda Expression ................................ 9
6. Functions in FPLs ..................................................... 11
7. IPL vs. FPL ............................................................... 13
8. Scheme overview ...................................................... 14
8.1. Get your own Scheme from MIT ...................... 14
8.2. General overview .............................................. 14
8.3. Data Typing ...................................................... 15
8.4. Comments ......................................................... 15
8.5. Recursion Instead of Iteration ........................... 16
8.6. Evaluation ......................................................... 17
8.7. Storing and using Scheme code ........................ 17
8.8. Variables ........................................................... 18
8.9. Data types ......................................................... 19
8.10. Arithmetic functions ......................................... 20
8.11. Selection functions............................................ 21
8.12. Iteration............................................................. 26
8.13. Defining functions ............................................ 27
9. ML ............................................................................ 28
10. Haskell ...................................................................... 29
A. Bellaachia Page: 1
11. Functional Programming Using Python .................... 31
11.1. List Manipulation.............................................. 31
11.2. Car & CDR ....................................................... 35
12. Functions .................................................................. 37
12.1. Composition...................................................... 37
12.2. Apply-to-all functions ....................................... 38

A. Bellaachia Page: 2
1. Definitions

 Functional programming languages were originally developed


specifically to handle symbolic computation and list-
processing applications.

 In FPLs the programmer is concerned only with functionality,


not with memory-related variable storage and assignment
sequences.

 FPL can be categorized into two types;

 PURE functional languages, which support only the


functional paradigm (Haskell), and
 Impure functional languages that can also be used for
writing imperative-style programs (LISP).

2. Applications
 AI is the main application domain for functional
programming, covering topics such as:
expert systems
knowledge representation
machine learning
natural language processing
modelling speech and vision
A. Bellaachia Page: 3
o In terms of symbolic computation, functional
programming languages have also proven useful in
some editing environments (EMACS) and some
mathematical software (particularly calculus)

 Lisp and its derivatives are still the dominant functional


languages (we will consider one of the simpler derivatives,
Scheme, in some detail).

3. Examples

 Programming Languages:
o Lisp, Scheme, Miranda, Sisal, Haskell, APL, ML

 Code Examples: Compute the sum of n integers


o A C implementation:

Sum=0;
for(i=1;i<=n;++i)
sum +=i;
 Computations is done by assignment.

o A Haskell implementation:

sum [1..10]

 Computations is function application.

A. Bellaachia Page: 4

You might also like