LitMy.ru - литература в один клик

Quick Functional Programming

  • Добавил: literator
  • Дата: 20-04-2023, 08:21
  • Комментариев: 0
Quick Functional ProgrammingНазвание: Quick Functional Programming
Автор: David Matuszek
Издательство: CRC Press
Год: 2023
Страниц: 146
Язык: английский
Формат: pdf (true)
Размер: 10.2 MB

Why learn functional programming? Isn’t that some complicated ivory-tower technique used only in obscure languages like Haskell?

In fact, functional programming is actually very simple. It’s also very powerful, as Haskell demonstrates by throwing away all the conventional programming tools and using only functional programming features. But it doesn’t have to be done that way. Functional programming is a power tool that you can use in addition to all your usual tools, to whatever extent your current mainstream language supports it. Most languages have at least basic support. In this book we use Python and Java and, as a bonus, Scala. If you prefer another language, there will be minor differences in syntax, but the concepts are the same. Give functional programming a try. You may be surprised how much a single power tool can help you in your day-to-day programming.

You probably think that functional programming (FP) is something dreamed up by ivory- tower academics using obscure languages that few people understand. You’re right.

You probably think that those weird languages such as Haskell, Standard ML, and OCaml are never going to be very popular with ordinary programmers.
Right again.

But did you notice…
• That ivory- tower academics are some pretty smart people?
• That the programming language you use every day, whatever it is, is getting more FP features?

“Pure” functional programming, abandoning all the conventional programming techniques, really is difficult. But you don’t have to do that. Think of it this way: Conventional programming consists of a collection of hand tools, and FP adds a power tool to the mix. Just one—it doesn’t do everything, and you still need all the other tools (unless you’re an ivory-tower academic), but where you can use it, it saves a lot of work.

Here’s a spoiler: FP will let you replace many of your loops with shorter, simpler, easier to understand function calls. Yes, there’s some unfamiliar syntax involved, but it’s just syntax, and you can get used to it very quickly. The new concepts, the parts you might think are the most difficult, turn out to be trivially simple. You may be surprised how much a single power tool can help you in your day- to- day programming.

FP is coming into prominence now because it is a far better way to write concurrent programs, suitable for multi- core computers. However, this is only a book about functional programming, not about concurrent programming; that would require a far larger volume.

Each chapter after the first begins with an explanation of some particular concept of functional programming. After that, there are sections exemplifying that concept in each of three languages:

• Python, because it is a simple, widely known language. Python has only a few of the most basic FP features.
• Java, because it is widely known and has many of the FP features. The developers of these features have done an awesome job in fitting these features into a language that was never designed to hold them.
• Scala, which has been designed from the ground up to be both object oriented and functional, and therefore provides the cleanest and most complete set of FP features.

I have tried to make this book accessible to programmers who do not know Python or Scala. The FP features of these languages can be understood without an in-depth knowledge of the language in which they occur. Unfortunately, no such claim can be made for Java.

Скачать Quick Functional Programming












[related-news] [/related-news]
Внимание
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.