Developing a program that detects possible uses of functionals in Standard ML source code and converts them to their higher order equivalents
Philipp Mayerhofer March 7, 2003
1
Structure
- 1. Introduction
- 2. Problem analysis
- 3. Design and implementation
- 4. Conclusion
2
Introduction
3
Background
- functionals factor out common behaviour
- map applies a function to every element of a list
fun map [ ] = [ ]
✁map f ( x : : xs ) = f x : : map f xs
- filter keeps only those elements of a list for which a predicate
holds
fun f i l t e r [ ] = [ ]
✁f i l t e r pred ( x : : xs ) = i f pred x then x : : f i l t e r pred xs e l s e f i l t e r pred xs ;
4