This preview shows pages 1–3. Sign up to view the full content.
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