* Haskell Programming from first principles
V Chapter 2
*
Values are irreducible, but applications of functions to arguments are reducible. Reducing an expression means evaluating the terms until you’re left with an irreducible value.
*
Haskell uses a non-strict evaluation (sometimes called “lazy evaluation”) strategy which defers evaluation of terms until they’re forced by other terms referring to them. p.84
*
Values are expressions, but cannot be reduced further. Values are a terminal point of reduction p.84
*
:load unloads previous function in GHCI (need to use cabal’s repl to load multiple functions) p.86

V
printInc2 n = let plusTwo = n + 2
in print plusTwo
-- turns into
printInc2' n =
(\plusTwo -> print plusTwo) (n + 2)
* which I guess means map let into \ (recall “\” means lambda in Haskell)
* This doesn’t work for every possible let expression as we don’t have a good way to translate let expressions that use free variables recursively5 into the lambda calculus.
V Exercises page 87
V
let x = 5 in x
* 5
V
let x = 5 in x * x
* 25
V
let id = \x -> x page 89 is the same as:
*
let id x = x
*
let a = b in c -- equivalent to (\a -> c) b (page 89)
*
c where a = b -- equivalent to (\a -> c) b (page 90)
*
x + 9001 where x = 10
(\x -> x + 9001) 10
V Exercises Page 90
V
let x = 3; y = 1000 in x * 3 + y
*
m1009 = x * 3 + y where x = 3 ; y = 1000
V let y = 10; x = 10 * 5 + y in x * 5
*
m300 = x * 5 where y = 10 ; x = 10 + 5 * y
V let x = 7; y = negate x; z = y * 10 in z / x + y
*
mneg17 = z / x + y where x = 7; y = negate x; z = y * 1
> Exercises Page 93
V waxOn Exercises Page 94
*
let waxon = x * 5 where z = 7 ; y = z + 8 ; x = y ^ 2
*
Prelude> waxon
1125
* formal parameter page 97 versus argument (bound parameter)
* expressioin = really “reducible expression” page 97
* redex = reducible expression
* A function is a mathematical object whose capabilities are limited to being applied to an argument and returning a result. Functions can be described as a list of ordered pairs of their inputs and the resulting outputs, like a mapping
* Operators are functions that are infix by default page 98
V
:type command. to get the type of a variable
* “type ‘a’