Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I know Lisp and Haskell are functional and logic programming languages respectively, but what exactly does this mean? How do they differ from other languages? I've heard that learning these will make you a better programmer and improve your logic. Is this true, and if I go learning Lisp or Haskell to a competent level will my programming improve and will I be better at handling any problem in any language? I just wanted to know to see if they are worth the effort of learning. Also are these languages useful in areas such as GUI and graphics or are they just useful for console applications?

share|improve this question

closed as off-topic by gnat, Jimmy Hoffa, Telastyn, Ross Patterson, JeffO Sep 9 '13 at 21:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about what language, technology, or project one should take up next are off topic on Programmers, as they can only attract subjective opinions for answers. There are too many individual factors behind the question to create answers that will have lasting value. You may be able to get help in The Whiteboard, our chat room." – Jimmy Hoffa, JeffO
If this question can be reworded to fit the rules in the help center, please edit the question.

23  
Using LISP and Haskell will make you a better LISP and Haskell programmer, I guarantee it. –  Neil Sep 9 '13 at 16:10
14  
@MasonWheeler I have to say; there is a lot in Haskell's type system you won't find in any other language, and LISP macros are nowhere to be found in any mainstream languages. Both of these things are worth learning because they do make you a better programmer in your working language. At least this has been my experience; Haskell made me a better enterprise C# developer. I know techniques for implementing separation of concerns cleanly that I never would have otherwise, and parsing problems will forever be much simpler for me than before I learned Haskell. –  Jimmy Hoffa Sep 9 '13 at 16:36
5  
Erlang is a functional language. Rabbit MQ is written in Erlang and Rabbit's used in lots of places to do lots of mission critical heavy lifting. Functional languages teach you to think differently about programming, and that's a nice extra tool to have at your disposal. While it's true some of those concepts have made it into more popular languages (e.g. lambda expressions in C# and C++), you still approach problem solving in a very different way when using a functional language. –  Binary Worrier Sep 9 '13 at 16:42
7  
@MasonWheeler There are perfectly good reasons a language may be more useful than the rest, but still not widely used. I can think of many: existing user base, too radical a change, when "good is good enough", and also... when the better tool requires programmers who are more formally trained. So popularity is not a good measure of usefulness. –  Andres F. Sep 9 '13 at 17:13
4  
Haskell is not a logic programming language and neither is Lisp. –  Isaac Kleinman Sep 9 '13 at 21:06

3 Answers 3

It is very much like learning math will improve your analytic skills and learning latin/classic literature will improve your writing skills.

People who designed those languages have thought hard about what does writing a program means. And those languages are the results of those researches.

That said, learning Java will also make you a better programmer. And learning C. The real benefits comes from learning languages with different philosophy. Then you can have your own opinion about the way a program should be written.

Edit

I realize this answer is not so useful for people who have not yet learn haskell and/or lisp. Here are some examples to explain further what I mean

LISP

Lisp believes that syntax should be minimal, and that everything should be either a list or a primitive (Lisp stands for List Processing). Even programs are mainly list containing other lists and symbols. Lisp allows you to manipulate programs as list, and to generate new programs on the fly. Hence the whole code is data and data is code motto.

The direct consequence is that the Lisp languages allows you to define any interface you want. A nice exemple is compojure which is a clojure web framework. Here is what a routing function look like

(defroutes app-routes
  (GET "/" [] view/page)
  (GET "/api" [] (wrap-aleph-handler api/socket-handler))
  (route/resources "/static")
  (route/not-found "page not found"))

Another nice exemple is the hiccup templating framework:

(html [:ul
  (for [x (range 1 4)]
    [:li x])])

As you can see, the result is as terse as in DSL like mustache, but allows you to use the language features such as (for [x (range 1 4)] block). Even nicer, you have all the tools to abstract and structure your code.

In other languages, the syntax is more complex. You cannot read a Java program as a bunch of lists. But by using Lisp, you get a better idea about what an ideal interface should look like, and what in your code can be abstracted away as data. It also helps you to see your favorite language as a big data structure, and to better understand its semantics.

Haskell

Haskell believes in strong static typing and purity. Pure functions are like mathematical functions: they are defined on a set of values, and map them on another set. Function don't have side effects, and values are immutable. Purity is interesting because it is not something a multi-paradigm language can have. A language is either pure or not.

One consequence is that you cannot perform IO action whenever you want (haskellers believes that this is a good thing). IO actions are defined as transactions, which are themselves pure values. The main value of a haskell program is a IO transaction executed when you run the program.

You have to deal explicitly with the data flow in your program. You cannot make two component communicate by writing & reading stuff in a global variable. You have to build and pass values.

Another feature mentioned by Jimmy Hoffa is the rich type system. While other languages have static typing, in haskell you can have things like:

length :: [a] -> Int (function from a list of a's to an int)

map :: (a -> b) -> [a] -> [b] (function that takes a a to b transform and a list of a's, and returns a list of b's)

The nice thing is that I don't need to explain what those function actually do: you already understand their behavior. What's more, functions with those signatures cannot really anything but compute the length of a list and map a transformation over a list.

In other typed languages, class hierarchies combined with the mutability make dealing with those types a nightmare. You have to understand things like covariance and contravariance, which are impossible to get right from a language perspective (ie simple, powerful and safe).

Either you take the safe path (like scala) and end up with a really complex language, or you take the simple path and get something which is either limited (google go generics limited to list and maps) or unsafe (dart generics which are always covariant).

By using haskell, you mainly learn about the benefits of purity, and how to write pure code.

share|improve this answer
2  
I don't know about Assembly, and I didn't mention it either. However assembly can help you understand how your programs are running. There are great post on SO of people who are able to analyse a piece of generated assembly in order to explain a performance issue. –  Simon Sep 9 '13 at 16:43
3  
@KChaloux I would write the answer but this question should be closed (I close voted accordingly). Simply put I could write my opinion and experience in an answer, but it would be no more right or wrong than the other answers, which is the problem is language-recommendation questions, and why I voted to close. –  Jimmy Hoffa Sep 9 '13 at 16:44
4  
OMG, @Neil knowing what the computer is actually doing most assuredly will make you a better programmer. I haven't written assembly in years but regularly read it (across a bunch of platforms) and if you care about how your program actually works, it's critical to know at least the basics. –  dash-tom-bang Sep 9 '13 at 20:45
1  
@Neil, in what case is being a worse programmer a benefit? What makes you bring up spaghetti code? What does spaghetti code have to do with assembly or being a good programmer, except in the fantasyland of not knowing assembly and needing a rationalization to avoid learning it? If anything, being a good assembly coder makes one highly aware of bad coding practices. –  dash-tom-bang Oct 31 '13 at 7:17
1  
@Neil we have strayed from the topic at hand. Nobody said anything about starting in assembly anyway. Learning a foreign language doesn't make you less proficient in your native tongue and in fact sometimes it can give you insights into communication that make you more effective with your native tongue. At worst, it gives no benefit. (Besides- programming aptitude is not determined by the first language one sees; some people understand pointers and recursion and others don't, regardless of first language.) –  dash-tom-bang Jan 8 at 6:21

tl;dr Learning new stuff can only make you a better programmer, but being a better programmer is not about the languages you can write code in.

What are the advantages of using LISP and Haskell?

LISP:

  1. Homoiconic code. This allows structured self-modifying code.
  2. Syntax-aware macros. They allow rewriting of boilerplate code.
  3. Pragmatism. CL is designed to get stuff done by working professionals. Most functional languages aren't, as a rule.
  4. Flexibility. It can do a lot of different things, all at reasonable speeds.
  5. Wartiness. The real world is messy. Pragmatic coding winds up having to either use or invent messy constructs. Common Lisp has sufficient wartiness that it can get stuff done.

Arguably the only real reasons to choose against CL is that the standard libraries are dated.

I will go out on a limb and say that in the general case, syntax should not be an issue to a professional software worker.

From: Why is Lisp useful?

Haskell:

Haskell is a computer programming language. In particular, it is a polymorphically statically typed, lazy, purely functional language, quite different from most other programming languages. The language is named for Haskell Brooks Curry, whose work in mathematical logic serves as a foundation for functional languages. Haskell is based on the lambda calculus, hence the lambda we use as a logo.

You can read there a description of Functional vs imperative

From: http://www.haskell.org/haskellwiki/Introduction

Will they make me a better programmer?

Yes, of course, knowing more languages and paradigms can only make you a better programmer, but get this straight:

There is not a single tool, a single book, a single programming paradigm that will make you a better programmer.

Learning different programming languages with different paradigms definitely help you to be a better programmer, learning to solve problems with different aproaches also benefit your logical thinking greatly.

Being a good programmer is not much about the language, but about having the ability to solve any problem in any language. And when you don't know the language, the ability to learn that language quickly and use it effectively.

I think, that the more global your thinking is, the better developer you are.

For example, you may add useful comments to your code, care about the readability of your code, the maintainability. Pay attention to the little details. Think before typing!. Learn about desing patterns. Follow good practices.

Disclosure: This is shameless advertising of the worst kind, because it is from my blog.

share|improve this answer
2  
+1 for shameless promotion. –  Neil Sep 9 '13 at 16:38
2  
Have you learned LISP or Haskell to any competent level? –  Jimmy Hoffa Sep 9 '13 at 16:38
7  
It's a little disingenuous to hear this from someone who knows near nothing of either language. You claim they aren't tools you need right now but you have no idea what they're tools for, so how can you know this? Also how can you advise someone what they will or will not learn from them, as far as you're aware LISP is a SQL derivative only useful in relational data analysis and Haskell might be a strict subset of Regexp. –  Jimmy Hoffa Sep 9 '13 at 17:13
6  
This doesn't really answer the question. You succeeded at the impressive feat of giving a vaguely general answer to a question about two languages you don't know :/ –  Andres F. Sep 9 '13 at 17:18
1  
@JimmyHoffa I think now you are just trying to be a troll, I said I want my app to be written in pure Objective-C, I want it to be native. Also, one doesn't need to know the syntax of a programming language to see if it suits your needs, how do you know en.wikipedia.org/wiki/Whitespace_%28programming_language%29 is not the right tool for a problem? do you learn to write code in it? or do you read a description of the language? –  jsedano Sep 9 '13 at 17:28

When you learn languages that are outside of the paradigm that you usually operate, it will open your mind to alternative solutions in your day to day and may even help you understand some features in your language of choice better. Just knowing those languages aren't going to make you a better programmer unless you can take the lessons you learned from those languages and apply it to situations you see everyday.

That being said, it isn't limited to languages. When you read up on various data structures that you haven't seen or used before, it can help broaden the scope of you knowledge so the next time you encounter a problem you have one more possible solution.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.