Function-Type programming

Source: Internet
Author: User

Because the reading is the PPT of Peking University, so this basic belongs to reading notes, not too easy to organize into fluent articles.

First of all, the functional programming, in common language or more than the use of more command-type language (such as C/C + +), the function is actually everywhere, throw away functional programming, other programming languages have "function this concept." Functions are often used so that they are not valued. The collection of functional computations is an abstract concept that the programming language provides to us, allowing us to think on this concept, that is, encapsulation. Any high-level language is bound to provide a certain degree of abstraction to programmer, thereby improving the efficiency of programming. Object-oriented Also, individuals feel that object-oriented provides a higher level of abstraction, a higher level of encapsulation. More conducive to people to understand the program. Of course, this is not certain, mainly to see the ability of programmers. (think: So is it that abstract ability can reflect a programmer's programming ability at some level, programmer programming should be at the abstract level rather than the underlying technical details). Back to the point, that functional programming must also provide a function abstraction. What is the difference between functional programming and other programming languages? In functional programming there is a sentence often referred to as "a function is a class citizen". What is a one-class citizen is the enjoyment of all rights. What are the aspects of rights in a programming language, because it is just beginning to learn functional programming, so it may not be summed up, for example, can be assigned as a variable, as a parameter and return value. This is to be separated from the function pointer of C (C function in the code area, only Read permissions, if you go to modify the function pointer will occur segment fault, so only to provide a part of functional programming features, there must be an unsupported method), functional programming in the function as an "object" to treat, since it is " Object "Then you should be able to manipulate it like a variable. Functional programming not only provides a simple function (like other programming languages) with function-level abstraction, but more importantly provides an abstraction of the computational process. So it is much easier to understand this and then to learn about functional programming, for example, in functional programming, why functions can be used as parameters because only a small part of the calculation is different, the others are the same. In this way, we need to pass this "different small part" as a function into it. Functional programming can use functions as return values because new functions can be generated in the function by repackaging the incoming function (meaning a bit of inheritance).

Ambda for example. Lambda is an anonymous function. In the function, scheme supports block scopes, allowing functions to be defined in functions, so that the code is organized to facilitate the organization. At the same time many functions because it is a one-time, no need to name, once in the form of lambda expression.

Function-Type programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.