Functional Programming - What is it? It is cool? Is it awesome? Is it fun? Is it so important, that it's worth having an entire graduate class dedicated to it? Functional Programming uses functions for absolutely all aspects of programming. And you know what a function is. You give it input. You get output back. Iterative Programming involves wacky things like statements; loops; if-then-else. Sometimes (like in BASIC) flow-of-control statments (like GOTO. In functional programming, repeated work is normally handled by recursion. (Although, some languages do have a "loop" function.) Decisions are generally made by some sort of "if" function. A pure function is one what always gives the same answer on the same input. This is frequently not what happens in iterative languages BECAUSE iterative languages rely heavily on "global variables" which frequently affect the running of a method yielding different answers, even on the same input. Some exceptions I'll allow: reading input (if you read from the keyboard, you're going to get different things). Random number generator. System Clock. Imagine a prime number (65537). The integers from 1 to p-1 form a group under the operation ab mod p. Now, if you look at individual ints from 1 to p-1, say, n, and take a look at n, n^2, n^3, n^4, sometimes you will eventually every single int from 1 to p-1 in this pattern (sometimes you won't). If you do, then n is a generator. So, find such a generator. I used 32273 as a generator the 65537 group. This means, I can start with any int: 1000 1000 x 32273 mod 65537 = 28796 28796 x 32273 mod 65537 = 18648. I will eventually hit every number between 1 and 65536 before returning to 1000. Moreover, the numbers to the naked eye appear to be random. There is no obviously discernible pattern here. 65537 = 2^16+1 I take the int sequence and return (n-1)/65536.0. This gives a real number between and including 0 and not including 1. Once you have the first number in the sequence, you get all subsequent numbers by applying the formula (multiply by generator, mod by prime). So, how do you get the first number in the sequence? System clock. The first language is "functional C". 1. No global variables. 2. Every method is of the same format methodname () { return ; } In other words, every methods contains exactly one statement and that one statement is a return statement. 3. Repeated work is handled by recursion. 4. Decision making is handled by the ternary operator. ?: 5. Use of comma operator is not only encouraged, it's probably necessary.