*introduction* fp4us is an introduction to fp concepts using javascript which is inherently functional what is functional? fn as first class => fns as args, fns as returns rest of us? => rest of us who dont use the functional power of js or rest of us for whom fn languages are hard to grasp *benefits* (skip) Immutable => final in java, not in js, immutability in haskell, lisp Stateless -> Recursion, No side effects => Easy unit testing, Easy debugging Concurrency => parallelizable High availability
HOF fns as args fns that return fn as args example using uppercase, lowercase Closure ex: delta in HOF example Other examples in currying
Currying partial application of functions Haskell Curry analogy for curry - precooked js does not have currying built in but its easier to extend bcos fns are first class objects currying left is common in haskell currying right is possible in js Recursion ex: power in currying example
Lazy evaluation: fun vs fun() in js fun vs (fun) in Lisp Infinite data structures Infinite sequence, fibonacci generator