Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do I learn to "enlighten myself with the ways" of functional programming?

I've been coding for a few years now, nothing too complicated. C++ is what I know best. I recently stumbled into Paul Graham's site, coding horror, and now here.

What do I learn to "enlighten myself with the ways" of functional programming? Haskell, Scheme or CLisp?

like image 620
Karthick Avatar asked Mar 12 '10 10:03

Karthick


People also ask

Why should I learn functional programming?

Let's take a look at some reasons why you might want to consider learning Functional Programming. One of the many aspects that makes FP so appealing is that code creation is simplified. The code tends to be more concise and more predictable. With simpler, cleaner code, it's also easier to test and to maintain.

What is a good functional programming language to learn?

Elixir: Elixir is the most popular programming language in the world. It is a functional, general-purpose, and concurrent programming language that runs on the BEAM virtual machine. It is popular for its suitability to build low-latency, fault-tolerant, and distributed applications.

Should I learn functional programming first?

The biggest plus of learning a functional language before learning an OOP lang is that your programming skills get developed first and then you can easily grasp the OOP concepts.

Is it hard to learn functional programming?

There is no single reason why learning Functional Programming is difficult, but here are a few of the biggies (your mileage may vary). For people like me, i.e. someone who has been successfully programming for a long time in Imperative Languages, it's especially difficult because you have to unlearn many things.


2 Answers

If you're interested in functional programming, Haskell is the only purely functional language on that list. Common Lisp is a weakly functional mixed-paradigm language, and Scheme is more strongly functional but still not pure. Lisps are interesting for other reasons, but Haskell is pretty much the state of the art for functional programming.

Incidentally, the reason I encourage more strongly functional languages like Haskell is because a large part of "learning functional programming" is learning how to think of your program in a different way. If your language makes it feel natural to write imperatively, it's too easy to fall into that way of thinking and never realize there's a different way to do it.

like image 94
Chuck Avatar answered Oct 05 '22 18:10

Chuck


Of the three, I'd say Scheme is the simplest overall, if that's your main concern. SICP uses Scheme, and is itself a great resource for learning to program the functional way.

However, Common Lisp has many advanced features that make it quite expressive, such as powerful error handling (more powerful than exceptions), multimethods and support for aspect oriented programming.

You might start with one but, in the end, you should study many languages.

like image 25
outis Avatar answered Oct 05 '22 17:10

outis