JS Functional Programming "translation" 5. Category theory

Source: Internet
Author: User

?? Functional programming in JavaScript main directory The fifth chapter of the category theory of functional programming in JavaScript

Thomas Watson (then IBM chairman) said a famous word, "I think the world only five computer market." It was 1948, when everyone thought that computers would only be used for two things: math and engineering. Even the most technically daring assumptions do not suggest that one day computers can translate Spanish into English, or simulate the entire weather system. At that time the fastest computer is IBM's SSEC, can calculate 50 times per second, display terminal to appear after 15 years, multi-tasking means that multiple user terminals share a single thread. The transistor changed everything, however the foresight of the technology did not keep up. In 1977, Ken Olson (Dec founder) said another foolish prophecy: "No one has a reason to want to have a computer at home."

It's obvious to us that computers are not just for scientists and engineers, but it's just hindsight. It was normal to think that computers could only be mathematically calculated 70 years ago. Not only did Watson not realize that computers would change society, he was not aware of the ability to reform and evolve mathematics.

But the potential of computers and mathematics is not overlooked by all. John McCarthy invented Lispin 1958, a revolutionary algorithm-based language that brought computers into the new era. Since then, Lisp has played an important role in the idea of using abstract layers (compilation, interpretation, virtualization), which has prompted the computer to change from a machine that can only be used in mathematics to today.

From Lisp to Scheme, a direct prototype of JavaScript. Now it brings us a cycle. If the computer is just a mathematical machine in the core, it is reasonable to have superiority in the mathematical-based programming paradigm.

In this case, "mathematics" does not mean that the computer is obviously able to do numerical operations, but rather to describe discrete mathematics: the study of discrete, mathematical structures such as logical declarations or computer language commands. By treating the code as a discrete mathematical structure, we can apply concepts and ideas to mathematics. This is why functional programming plays such an important role in artificial intelligence, Atlas search, pattern recognition, and other challenging areas of computer science.

In this chapter, we will experiment with some concepts and their applications for problems in everyday programming, including:

    • Category theory (category theory)
    • State shot (morphisms)
    • Functor (Functors)
    • Maybes
    • Promises
    • Lenses
    • function combination

Using these concepts, we can easily and safely write out the entire library and API. And we have to start with the interpretation of the category theory until it is implemented in JavaScript.

Category theory (category theory) functor (the realization of Functorsmonads category theory fifth chapter summarizes the next chapter advanced topics and JavaScript flaws

JS Functional Programming "translation" 5. Category theory

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.