210 likes | 380 Views
HASKELL LANGUAGE REPORT. Brett Nelson. John von Neumann. PAUL BERNAYS. ALAN TURING. ALONZO CHURCH. HASKELL CURRY. WHAT DO YOU NOTICE?. Lambda Calculus. Stephen Kleene Alonza Church. Lambda Fryer Function. x.fried-x If we applied chicken to the fryer function like this:
E N D
HASKELL LANGUAGE REPORT Brett Nelson
Lambda Calculus • Stephen Kleene • Alonza Church
Lambda Fryer Function x.fried-x If we applied chicken to the fryer function like this: x.fried-x chicken => fried-chicken
Church Integers 0 = λf.λx.x 1 = λf.λx.f(x) 2 = λf.λx.f(f(x)) 3 = λf.λx.f(f(f(x))) 4 = λf.λx.f(f(f(f(x))))
Successor Function SUCC = λs.λw.λt.w(s w t)
Successor Function SUCC = λs.λw.λt.w(s w t) λs.λw.λt.w(s w t) (λf.λx.x)
Successor Function SUCC = λs.λw.λt.w(s w t) λs.λw.λt.w(s w t) (λf.λx.x) λw.λt.w((λf.λx.x) w t)
Successor Function SUCC = λs.λw.λt.w(s w t) λs.λw.λt.w(s w t) (λf.λx.x) λw.λt.w((λf.λx.x) w t) w.λt.w((λx.x) t)
Successor Function SUCC = λs.λw.λt.w(s w t) λs.λw.λt.w(s w t) (λf.λx.x) λw.λt.w((λf.λx.x) w t) w.λt.w((λx.x) t) λw.λt.w( t )
Church Integers λw.λt.w( t ) 0 = λf.λx.x 1 = λf.λx.f(x) 2 = λf.λx.f(f(x)) 3 = λf.λx.f(f(f(x))) 4 = λf.λx.f(f(f(f(x))))
Quicksort qsort( a, lo, hi ) int a[], hi, lo; { int h, l, p, t; if (lo < hi) { l = lo; h = hi; p = a[hi]; do { while ((l < h) && (a[l] <= p)) l = l+1; while ((h > l) && (a[h] >= p)) h = h-1; if (l < h) { t = a[l]; a[l] = a[h]; a[h] = t; } } while (l < h); t = a[l]; a[l] = a[hi]; a[hi] = t; qsort( a, lo, l-1 ); qsort( a, l+1, hi ); } }
Quicksort qsort [] = [] qsort (x:xs) = qsort elts_lt_x ++ [x] ++ qsort elts_greq_x where elts_lt_x = [y | y <- xs, y < x] elts_greq_x = [y | y <- xs, y >= x]
Why Haskell? Moore’s Law Physical Limits
Conclusion If you want to be part of the future of computer science. Learn Haskell and don’t comb your hair.