History & Functional Programming Primer

Class: CSCE-314


Notes:

1. Overview of Programming Language Evolution

Imperative Programming:

Functional Programming:

Example comparison:
Imperative (C):

total = 0; for(i = 0; i < n; i++) total += arr[i];

Functional (Haskell):

total = sum arr

Why Functional Programming?

Object-Oriented Programming (OOP):

Modern Multi-Paradigm Languages:

2. Functional Programming Concepts

Purity:

Immutability:

Recursion:

fact 0 = 1
fact n = n * fact (n-1)

Higher-Order Functions:

3. Why We Start with Haskell

Haskell Enforces Purity:

Strong Type System:

Example:

add :: Int -> Int -> Int
add x y = x + y

Different by Design:

Contrast with Everyday Languages:

The Payoff: