15-Functional%20Programming - ICS 313 - Fundamentals of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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

Page1 / 6

15-Functional%20Programming - ICS 313 - Fundamentals of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online