Download presentation
Presentation is loading. Please wait.
1
Programming Languages
Meeting 9 November 1/2, 2016
2
Functional Programming Languages
Work with pure FP languages No assignment statement No loops No objects or methods Still have sequence implemented as composition Recall [s1;s2] = [s2]○ [s1] Still have if – then – else Loops are replaced by recursion
3
FP (2) Four components Objects Primitive functions Functional forms
Function definition mechanism, for secondary functions
4
Objects The only data type Not the objects from Java, but: Objects
Atoms Lists of objects The symbol called bottom, signifying “undefined”
5
Atoms Forms of atoms sequence of characters, a string, an identifier
sequence of digits, an integer [perhaps with sign] syntax of a real number T, meaning true F, meaning false
6
Functions Functions on the set of objects, the only operation on objects Programs are constructed using composition of functions. Two types of functions Entire: Defined on all objects Partial: Defined on some, but not all objects
7
Notation for Semantics
One line function specification with choices, developed by John Backus Symbols : apply the function to the argument is defined as −> if – then ; else
8
Primitives Our set of primitives: first last head tail atom? null?
list?
9
More Primitives appendr appendl length The arithmetic functions
The comparison functions
10
Functional Forms The four Cs constant composition denoted by overbar
depends on one object composition denoted by centered small circle depends on two functions
11
Functional Forms (2) construction conditional denoted by [ ]
depends on n functions [f]:x <−> <f:x> (n=1) conditional denoted using −> and ; depends on a predicate and two functions
12
Functional Forms (3) apply to all insert (also known as reduce)
denoted by αf depends on one function works only on lists insert (also known as reduce) denoted by /f depends on one function with a number of properties
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.