13 Replies - 518 Views - Last Post: 22 April 2021 - 10:51 PM

#1 Yossu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 01-November 18

Should I learn Lisp or Haskell (or something else)?

Posted 14 April 2021 - 07:25 AM

Before I start, please note that I am NOT asking which is better. I don't believe either is "better," they both have their strengths and (presumably) weaknesses. I'm asking which you think would be better for me to learn, given my situation.

So, with that out of the way, here is the picture. My day job involves writing desktop aps and web sites using C#. That's highly unlikely to change, so any thoughts of learning another language here are not career-oriented. Therefore, neither the practicality of producing commercial apps in a language, nor the chances of getting a job using that language are of relevance.

My main interests here are entertainment and education. I am interested in learning something different from C#, as I enjoy learning, and want to stimulate my mind. I have also heard from many people that learning Lisp or Haskell will make you a better programmer, even if you don't use the languages.

However, I'm not sure which of the two would be better, and am looking for some suggestions. I have been leaning towards functional programming for some years, but am only partly there. I use the LanguageExt Nuget package, which allows you to do pretty functional stuff in C#, and think that one of these languages (Haskell in particular, as it seems very pure, unlike Lisp which seems a little more multi-paradigm) would help concentrate my mind into thinking in an FP way.

Obviously, if you feel that a different language altogether would be of benefit, please feel free to suggest it.

Any comments? Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Should I learn Lisp or Haskell (or something else)?

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 16201
  • View blog
  • Posts: 64,509
  • Joined: 12-June 08

Re: Should I learn Lisp or Haskell (or something else)?

Posted 14 April 2021 - 07:44 AM

View PostYossu, on 14 April 2021 - 08:25 AM, said:

Before I start, please note that I am NOT asking which is better.
[...]
However, I'm not sure which of the two would be better, and am looking for some suggestions.



I just found that amusing. ;)

What does 'better' mean for you? Stimulate your mind? Make money? Tickles some unreported fancy?

Why not try both out? Give each a two week trial run. Heck, maybe toss in F# if you are in the .NET sphere.

https://docs.microso.../dotnet/fsharp/
Was This Post Helpful? 0
  • +
  • -

#3 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 12253
  • View blog
  • Posts: 20,767
  • Joined: 19-March 11

Re: Should I learn Lisp or Haskell (or something else)?

Posted 14 April 2021 - 08:11 AM

I feel like learning a lisp is a good move for anyone who's learned a programming language that isn't lisp. Not that you'll use it to write programs, but it'll help you write better programs in your language of choice. ML (the fons et origo of OCAML, Scala, F$, etc) is another good one.

The Little Schemer is a reasonable place to expose yourself to some interesting ideas through the medium of a popular Lisp variant. The same authors (or an intersecting set of authors anyway) also produced The Little MLer, which covers similar ideas in an ML context (and exposes some interesting ML language features). Dan Grossman's Programming Languages course on coursera includes quick intros to both ML and Racket (a scheme derivative), in addition to Ruby, if you prefer to get your instruction by video this might be a useful option.

Once you've spend a little time in lisp and ML, I strongly recommend Michaelson's Functional Programming Through Lambda Calculus if you want your mind blown.

I have no exposure to Haskell, so I can't say one way or another what the advantages of learning it might be, but it's certainly popular with a certain subset of programming nerds.
Was This Post Helpful? 0
  • +
  • -

#4 Yossu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 01-November 18

Re: Should I learn Lisp or Haskell (or something else)?

Posted 14 April 2021 - 10:48 AM

View Postmodi123_1, on 14 April 2021 - 07:44 AM, said:

View PostYossu, on 14 April 2021 - 08:25 AM, said:

Before I start, please note that I am NOT asking which is better.
[...]
However, I'm not sure which of the two would be better, and am looking for some suggestions.


I just found that amusing. ;)/>


Hee hee, I didn't spot that! What I meant was which would be better for me, but I guess you realised that :smartass:

View Postmodi123_1, on 14 April 2021 - 07:44 AM, said:

What does 'better' mean for you? Stimulate your mind? Make money? Tickles some unreported fancy?

I tried to define what I meant by "better" in my original question. Stimulate my mind - ye. Make money - nah, unlikely. Tickles some unreported fancy - I'm always game for having a fancy tickled!

View Postmodi123_1, on 14 April 2021 - 07:44 AM, said:

Why not try both out? Give each a two week trial run. Heck, maybe toss in F# if you are in the .NET sphere.


Is a week enough? My experience of learning something vert different (for example, F#, which I played with quite a bit) is that the steep initial learning curve means that you need quite an investment before the light bulb goes on. I don't have the time to learn two, which is why I am asking for advice for one over the other.
Thanks

View Postjon.kiparsky, on 14 April 2021 - 08:11 AM, said:

I feel like learning a lisp is a good move for anyone who's learned a programming language that isn't lisp. Not that you'll use it to write programs, but it'll help you write better programs in your language of choice.

That's what started me in Lisp, but I wondered if the same would be with Haskell. After all, Haskell is (from what I understand so far) much more pure, so is probably a better way to get my head thinking in FP terms.

You mentioned a few dialects of Lisp, is there any way to choose between them? I did some searching on this before I asked my question, and found there are many dialects, each with its own fans, each one saying why it's better.

View Postjon.kiparsky, on 14 April 2021 - 08:11 AM, said:

I have no exposure to Haskell, so I can't say one way or another what the advantages of learning it might be, but it's certainly popular with a certain subset of programming nerds.

I guess I would fall into that category, so maybe it's right for me! Mind you, I think if you ask your average programmer (ie C#, Java, C++, etc), they would say that anyone who programs in Lisp would be pretty nerdy, so I guess we're already way out in nerd land before we choose a language!

Thanks
Was This Post Helpful? 0
  • +
  • -

#5 ppbitb   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 1
  • Joined: 12-April 21

Re: Should I learn Lisp or Haskell (or something else)?

Posted 14 April 2021 - 01:21 PM

Hey there

(This is my first post on the forum, let's see if it gets published.)

I have some very light experience with LISPs languages (from using Emacs for years, playing around with Racket, Common Lisp and Clojure, and working through ~60% of SICP with Scheme recently), and I have technically written 20 lines of Haskell but no more than that.

The question doesn't have a single answer. "Should I go to Rome or Paris?" I don't know, both places are great and you are almost guaranteed to have a good time in either one. Spend a full week in one this year, and another full week in the other next year. The only bad choice is to spend 1.5 day in one then 1.5 day in the other. Unless you have friends in one of them, then go there.

Out of my varied experiences playing with Lisp, I feel working through SICP was the first time I actually spent enough time and had enough guidance to get a clear idea of what that world is like. So I would recommend a comparable approach regardless of the language.

Be aware that Lisp is much broader than FP. If that is specifically what you want to spend time on, maybe another language would be a better choice, unless you pick Clojure
Was This Post Helpful? 1
  • +
  • -

#6 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 12253
  • View blog
  • Posts: 20,767
  • Joined: 19-March 11

Re: Should I learn Lisp or Haskell (or something else)?

Posted 14 April 2021 - 02:48 PM

View PostYossu, on 14 April 2021 - 12:48 PM, said:

That's what started me in Lisp, but I wondered if the same would be with Haskell. After all, Haskell is (from what I understand so far) much more pure, so is probably a better way to get my head thinking in FP terms.


To be honest, the more I know about "functional programming" the less I think it's a thing. Really, if it's anything it's just the habits of mind that languages like lisp, ML, and their offspring encourage. So I wouldn't worry too much about "purity" and stuff like that. It's not a cult, it's just another way to write programs.


Quote

You mentioned a few dialects of Lisp, is there any way to choose between them? I did some searching on this before I asked my question, and found there are many dialects, each with its own fans, each one saying why it's better.



I don't think there's a lot of need to choose. You could spend ages parsing this, but it's really more interesting and useful to pick something and start playing with it. If you don't like it, you'll know soon enough and you'll know why, and you'll have learned something from that.

View Postppbitb, on 14 April 2021 - 03:21 PM, said:

Hey there

This is my first post on the forum,



Welcome!

Quote

The question doesn't have a single answer. "Should I go to Rome or Paris?" I don't know, both places are great and you are almost guaranteed to have a good time in either one. Spend a full week in one this year, and another full week in the other next year. The only bad choice is to spend 1.5 day in one then 1.5 day in the other. Unless you have friends in one of them, then go there.


I disagree with your first sentence. I think it does have a single answer, and you've given it :) (or at least, you've got pretty close)
Was This Post Helpful? 2
  • +
  • -

#7 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 1060
  • View blog
  • Posts: 4,061
  • Joined: 13-June 14

Re: Should I learn Lisp or Haskell (or something else)?

Posted 14 April 2021 - 11:38 PM

I think of functional programming as a bunch of good ideas that are broadly applicable across languages. Kevlin Henney has some great talks on the ideas: https://youtu.be/lNKXTlCOGEc and https://youtu.be/nrVIlhtoE3Y. Rich Hickey, who's behind Clojure has a talk on immutability that might also be worth a watch: https://youtu.be/-I-VpPMzG7c.

This post has been edited by ndc85430: 14 April 2021 - 11:44 PM

Was This Post Helpful? 0
  • +
  • -

#8 Yossu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 01-November 18

Re: Should I learn Lisp or Haskell (or something else)?

Posted 15 April 2021 - 10:49 AM

Thanks to all of you. After talking it over with some other people as well, I decided to go for Lisp. I have a bit of experience with it, and will see how I get on.

Thanks again for the comments.
Was This Post Helpful? 0
  • +
  • -

#9 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 12253
  • View blog
  • Posts: 20,767
  • Joined: 19-March 11

Re: Should I learn Lisp or Haskell (or something else)?

Posted 15 April 2021 - 11:34 AM

Sounds like fun.

If you get interested in looking at the SICP material, it's worth pointing out that MIT's opencourseware includes lectures and course materials for at least one iteration of Abelson and Sussman's teaching of that course. Might be worth looking at in conjunction with the book.

Also, if you really want to nerd out on this, Paul Graham's On Lisp is deep and chewy and it's out there as abandonware. The original is out of print and costs $ridiculous on Amazon, but I believe you can still get a POD version from Lulu.com built from the original files for basically the cost of printing. Looks good on your shelf next to SICP :)
Was This Post Helpful? 0
  • +
  • -

#10 Yossu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 01-November 18

Re: Should I learn Lisp or Haskell (or something else)?

Posted 18 April 2021 - 03:21 PM

@jon.kiparsky Thanks for the tips. You're right about the price of On Lisp, it's quite amazing!
Was This Post Helpful? 0
  • +
  • -

#11 xclite   User is offline

  • I wrote you an code
  • member icon


Reputation: 1520
  • View blog
  • Posts: 4,421
  • Joined: 12-May 09

Re: Should I learn Lisp or Haskell (or something else)?

Posted 18 April 2021 - 03:43 PM

Not trying to muddy the waters at all, you've received advice that I consider great.

Quote

Be aware that Lisp is much broader than FP


I agree with this quote - there are many great ideas in lisp that go beyond what people think of as FP. I would also say that FP is broader than lisp! Haskell and F# were already mentioned, so I won't belabor the point, but to me, the things I've learned from various FP languages is:

1. (lisp) programming in an AST is cool, and having access to the reader is potentially mind-altering (aka homiconicity and macros)
2. (all of them) functions as first class citizens is certainly better than instantiating anonymous classes in Java. Especially with partial application/currying, composition, etc
3. (Haskell, Clojure) Some people are really into lazy evaluation. I find that having it by default causes more problems that it solves
4. (Haskell, Scala, F#, OCaml) In spite of their meme status, monads are cool. Explaining them sucks, but the idea that there's a common vocabulary and compositional layer to various common wrapper types and collections and effects and that they all work together pretty nicely makes dealing with a well-types system way more interesting.

Lisp was great to me, but I found that I like actual syntax (Clojure actually has some nice ergonomic improvements on that front that a lot of lisp purists decry). Having errors as part of my type system, and having "suspension of evaluation" encoded as well really changed how I do things more than macros. Without Clojure, though, I would have had a harder time mapping many of these concepts or understanding the pitfalls they're saving me from (and of course they have piles of flaws as well... Haskell has like 8 string types).
Was This Post Helpful? 2
  • +
  • -

#12 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 1060
  • View blog
  • Posts: 4,061
  • Joined: 13-June 14

Re: Should I learn Lisp or Haskell (or something else)?

Posted 20 April 2021 - 08:39 AM

Agree on point 4 (though as usual, the rest is gold) particularly - I find I really like doing error handling with result types, for example.

I'm a Clojure fan - I've found it to be quite productive to write apps in (though I've only written my own reasonably small apps and I do tend to prefer static typing). I've not had a need for macros or the homoiconic stuff, though.

This post has been edited by ndc85430: 20 April 2021 - 08:44 AM

Was This Post Helpful? 0
  • +
  • -

#13 Yossu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 01-November 18

Re: Should I learn Lisp or Haskell (or something else)?

Posted 22 April 2021 - 06:04 AM

Thanks to both of you for your replies. Most of what you said is a bit over my head at the moment, but I'm sure it will come clearer with time.

For various reasons, not least of which a a decent IDE, I have settled on Racket for the moment. I'm just working my way through some beginner's stuff to get myself familiar with the language, then I can (hopefully) start tackling some interesting stuff.

Thanks again.
Was This Post Helpful? 0
  • +
  • -

#14 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 1060
  • View blog
  • Posts: 4,061
  • Joined: 13-June 14

Re: Should I learn Lisp or Haskell (or something else)?

Posted 22 April 2021 - 10:51 PM

If you're interested in seeing how you can do error handling in a functional way with a result monad, I showed an example in Python here.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1