This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ICS 313 - Fundamentals of Programming Languages 1 15. Functional Programming 15.1 Introduction Â¡ The design of the imperative languages is based directly on the von Neumann architecture ` Efficiency is the primary concern, rather than the suitability of the language for software development Â¡ The design of the functional languages is based on mathematical functions ` A solid theoretical basis that is also closer to the user, but relatively unconcerned with the architecture of the machines on which programs will run ICS 313 - Fundamentals of Programming Languages 2 15.2 Mathematical Functions Â¡ A mathematical function is a mapping of members of one set, called the domain set, to another set, called the range set Â¡ A lambda expression specifies the parameter(s) and the mapping of a function in the following form Î» (x) x * x * x for the function cube (x) = x * x * x Â¡ Lambda expressions describe nameless functions Â¡ Lambda expressions are applied to parameter(s) by placing the parameter(s) after the expression e.g. ( Î» (x) x * x * x)(3) which evaluates to 27 15.2 Mathematical Functions (continued) Â¡ Functional Forms Â¡ A higher-order function, or functional form, is one that either takes functions as parameters or yields a function as its result, or both Â¡ Function Composition ` A functional form that takes two functions as parameters and yields a function whose result is a function whose value is the first actual parameter function applied to the result of the application of the second Form: h ï€ â‰¡ ï€ f Â° g which means h (x) â‰¡ ï€ f ( g ( x)) ICS 313 - Fundamentals of Programming Languages...
View Full Document
- Spring '07
- Functional Programming, Imperative languages, Functional Languages