Introduction to Functional Programming in Haskell
1 / 51
Introduction to Functional Programming in Haskell 1 / 51 Outline - - PowerPoint PPT Presentation
Introduction to Functional Programming in Haskell 1 / 51 Outline Why learn functional programming? The essence of functional programming What is a function? Equational reasoning First-order vs. higher-order functions Lazy evaluation How to
1 / 51
2 / 51
Why learn functional programming? 3 / 51
Why learn functional programming? 4 / 51
The essence of functional programming 5 / 51
The essence of functional programming 6 / 51
The essence of functional programming 7 / 51
The essence of functional programming 8 / 51
The essence of functional programming 9 / 51
The essence of functional programming 10 / 51
void qsort(int low, int high) { int i = low, j = high; int pivot = numbers[low + (high-low)/2]; while (i <= j) { while (numbers[i] < pivot) { i++; } while (numbers[j] > pivot) { j--; } if (i <= j) { swap(i, j); i++; j--; } } if (low < j) qsort(low, j); if (i < high) qsort(i, high); } void swap(int i, int j) { int temp = numbers[i]; numbers[i] = numbers[j]; numbers[j] = temp; } The essence of functional programming 11 / 51
The essence of functional programming 12 / 51
The essence of functional programming 13 / 51
The essence of functional programming 14 / 51
The essence of functional programming 15 / 51
The essence of functional programming 16 / 51
The essence of functional programming 17 / 51
The essence of functional programming 18 / 51
The essence of functional programming 19 / 51
The essence of functional programming 20 / 51
The essence of functional programming 21 / 51
The essence of functional programming 22 / 51
How to functional program 23 / 51
How to functional program 24 / 51
How to functional program 25 / 51
How to functional program 26 / 51
How to functional program 27 / 51
How to functional program 28 / 51
How to functional program 29 / 51
How to functional program 30 / 51
How to functional program 31 / 51
How to functional program 32 / 51
How to functional program 33 / 51
How to functional program 34 / 51
How to functional program 35 / 51
How to functional program 36 / 51
How to functional program 37 / 51
How to functional program 38 / 51
How to functional program 39 / 51
How to functional program 40 / 51
How to functional program 41 / 51
How to functional program 42 / 51
How to functional program 43 / 51
How to functional program 44 / 51
How to functional program 45 / 51
How to functional program 46 / 51
How to functional program 47 / 51
How to functional program 48 / 51
Type inference 49 / 51
Type inference 50 / 51
Type inference 51 / 51