Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 385 Bytes

functional-programming.md

File metadata and controls

42 lines (30 loc) · 385 Bytes

#Polymorphism

id Ints :: Int -> Int
idInt x = x

idString :: String -> String
idString x = x

converted into

id :: a -> a
id x = x

#Currying

function add(a, b){
	return a +b;	
}

$add(3,4);

function add(a){ return function (b) { return a + b; } }

add(3)(4);

#Looping in FP?

  • Recursion
  • Map
  • Fold

Try not to use loops!!!