### Present Remotely

Send the link below via email or IM

• Invited audience members will follow you as you navigate and present
• People invited to a presentation do not need a Prezi account
• This link expires 10 minutes after you close the presentation

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

No description
by

## Daniel Hanover

on 28 February 2014

Report abuse

Reduce code volume
Reduce code complexity
Increase program efficiency when dealing with large datasets (lazy evaluation)
Simplest Turing-Complete Programming Language EVER!
variables all single-letters a...z
defining functions: λ<arguments>.<output>
Using functions: λx.xy applies identity function to y
λx.xy → y
Expressions evaluated left-to-right
Variable Types:
Bound: part of function definitions, can be replaced by any letter
Free: function input
in λx.xy, x is bound and y is free (λx.xy = λt.ty)
and how Lambdaλ Calculus will explode your brain
λ Calculus
Declaring Functions
Haskell in the real world - QuickSort
Only 2 keywords: lambda and "."
See the alligator-and-egg paradigm at: http://worrydream.com/AlligatorEggs/
λx.x is the identity function
The Basics
Data: Numbers and Booleans
Numbers defined recursively:
1 = λxy.x(y)
2 = λxy.x(x(y))
3 = λxy.x(x(x(y)))
Booleans:
True = λxy.x
False = λxy.y
Church Numerals
Data Structures:
Array: λx.xab
"a" holds first element
"b" holds the rest
Recursive
Working With Data
Increment Function
λwyx.y(wyx)
1. λwyx.y(wyx)(λuv.uuv)
Example:
Multiplication Function
Exponential Function
λxyz.x(yz)
2
No free variables
2. λyx.y((λuv.uuv)yx)
3. λyx.y(yyx)
4. λyx.yyyx = 3
λxy.yx
AND
λxy.xy(λst.t)
OR
λxy.x(λst.s)y
Example:
1. (λxy.xy(λst.t))(λpq.q)(λst.s)
T
F
2. ((λpq.q)(λst.s)(λst.t))
3. (λst.t) = F
NOT
λx.x(λpq.q)(λab.a)
Syntactic Sugar
Return statement
Java:
No variables!
No loops!
Using Functions
Function
Argument
Dollar Symbol
Error
: Print thinks its being given two arguments, but it can only handle one
=
Expressions within parenthesis evaluated before being passed to print (Output: "7.2")
All content after \$ evaluated first
Converts prefix function to infix
funcName arg1 arg2 == arg1 `funcName` arg2
Grave Accent (`)
Programming Shortcuts that make life easier
Static Typing
Polymorphism
“polymorphically statically typed, lazy, purely functional language.”
Lazy Evaluation
Expressions are not executed until they are needed
What it is
Doesn't execute unnecessary code - increased efficiency
Allows creation of infinite data structures
Full data structure not stored in memory, elements stored when needed
Completes in a matter of picoseconds
...as opposed to dynamic typing
Variable (or function) data types determined at compile-time
Prevents runtime bugs
Catch bugs before releasing to public
Fewer patches needed
Compiler knows exactly how much storage to allocate for each piece of data
efficient
Java also features static typing: Int x = 5
It's a fairly common feature...
Haskell methods do not need to specify input types
let's modify our previous sumMeth function:
Parametric
works with all data types for which + is defined (Ints, Doubles, etc.)
Does same thing, regardless of input type
Does different things, depending on input type
C - 24 lines
Super elegant coding!
Syntactic Sugar - List Comprehensions