
Ask HN: What should I give priority, Lisp, Haskell, or the Dragon Book? - thegenius2000
I realise the Lisp&#x2F;Haskell question has been asked before, so let me clarify. I&#x27;m about to enter my second year of uni (studying ECE) and I&#x27;m trying to decide what to focus my time on. I&#x27;m very interested in learning about writing compilers, but I also want to grow my skill in programming. Currently, the only languages I know are C-derivatives, and although I&#x27;m falling in love with Go, I know that it probably won&#x27;t give me fundamentally new ways to think about software.<p>So, to the issue at hand. I&#x27;ve been struggling to start The Dragon Book, as I find it incredibly dense and difficult to understand (though, to confess, I haven&#x27;t given it the dedication it deserves). Also, after reading some of PG&#x27;s essays and threads on StackOverflow&#x2F;Reddit&#x2F;Hacker News, I&#x27;ve been convinced that Lisp is an important language to learn, esp. because of functional programming (which I don&#x27;t know much about). Then I recently ran into Haskell, which seems to offer some of the same.<p>My question is this, because I&#x27;m in school, I have plenty of free time, but it&#x27;s still a limited resource. Between the 3 things I&#x27;ve listed (Lisp, Haskell, Compilers), which do you consider to be most enriching? (To the experienced) if you were back in your hacker-youth, knowing only a few languages and how to use a shell, what would you do? Am I making a mistake by starting with the Dragon, and if so, what do you recommend? Should I learn Lisp then Haskell or vice-versa? And what should I prioritize, compilers or more languages?
======
brudgers
My idiosyncratic but free advice:

Lisp and specifically Racket because:

1\. It's a community that is strongly oriented toward meeting the needs of
students.

2\. It's documentation is top notch.

3\. It's a single download with no external dependencies. There's even a
pretty good IDE (that even has a fairly compatible Emacs mode).

4\. Racket in the large is an ecosystem that has tools for many many aspects
of computer science that a student even at the graduate level might want to
play with [meta-programming, objects, type systems, logic programming, ffi,
Algol 60, web systems, etc.]. And it all comes down in one package and there's
no futzing around with package managers unless you want something that you
probably don't want for a long while...did I mention it's a single download.

5\. It's beginner friendly. It has its own textbook. It has a gradient of
languages with increasing complexity.

I've got nothing against Haskell or Go or anything else. And for a person in a
different situation I might be high on one of them...or Erlang. But the
orientation of their communities is different and so the problems that they're
good at is different, i.e. Go solves Google's problem of hiring a lot of
people with a C++ background for systems programming and the problem of
packaging programs that run on more servers than one can deploy reasonably to
in a week [it uses native executable binaries].

Or learn JavaScript.

Good luck.

~~~
stepvhen
I second this. I study new programming languages in my free time and install-
friction (or whatever its called, if it has a name) is a major factor in
whether or not I bother further with the language. A language that comes with
its own IDE and textbook is a dream. Haskell is fun, and it did indeed change
the way I thought about programs (it was my first functional language), but
once you leave something like Learn You a Haskell, it gets hairy fast, and the
wiki isn't the best resource.

I wouldn't suggest the dragon book until you can put forth all the effort it
takes. And as far as that goes, theres a lot of other, some would say better,
resources available:
[http://prog21.dadgum.com/30.html](http://prog21.dadgum.com/30.html)

------
such_a_casual
I'm currently learning Common Lisp. After I wrote my first real program with
it (not a tutorial), I knew I made the right choice. After hours getting
everything to work, when all was said and done, all that was left was this
tiny, succinct thing. Was this really everything I was trying to do? Had the
answer really been that simple? And I thought to myself, this is what
programming is supposed to be, not a bunch of spaghetti code brute forcing
one's self through the program, but the search for something concise and
beautiful that says something about the problem and solution.

There seems to be a certain personality associated with lisp programmers,
which emanates when they speak about the language. So logically I was pretty
confident in my choice from day 0. However it wasn't until I actually made a
program with it that I was emotionally confident and content with the choice.

In conclusion, I recommend you build a program with Haskell, Lisp, and/or an
idea from the dragon book. That experience may give you the best idea of what
path will be the most rewarding.

------
meric
Go Haskell. It's even more different from Lisp & Algol-like languages than the
difference between Lisp & Algol-like languages.

Lisp & Algol-like has the difference where Lisp's code is also data and its
code can rearrange code using macros written in Lisp itself. Both can have
functional programming inspired constructs like `map` and `fold` as functions.

Haskell is different because all its code is lazy. So if you write `take 1
(map ((*) 2) [1..1000000000000])`, it runs instantly even though writing
idiomatic lisp or python or C will have the computer spinning for ages going
through all those numbers you don't even use. It also has partial application
of functions, as well as pure functional programming by preventing you to
write a line that doesn't contribute to the returned value. The sophisticated
type system I have not ever seen outside of the ML family of languages,
either.

I haven't read the Dragon Book, but I've written some compilers in my free
time, and my compiler code was much better after I had a go at Haskell.

------
siscia
I will suggest, in your situation to read the SICP.

It us Scheme (a kind of Lisp), it is very functional focused, so many concept
will translate fairly good with Haskell and along the way it teach you the
fundamental of an interpreter, which is not quite a compiler, but still
matching what you are interested in.

And you will be a better coder after that book, I guarantee :)

------
kele
I suggest you don't start reading about writing compilers if you know only
C-derivatives.

As for the choice of a functional language for a beginner, I think you just
should pick whatever has better introductory materials available. You're
likely to experience a big mental shift by using a functional language for the
first time. It was a struggle for me, at least. That being said, I'd recommend
a Lisp derivative - Racket. It has a very nice tutorial and a good IDE. Also,
John Carmack's son game in Racket:
[https://news.ycombinator.com/item?id=10111479](https://news.ycombinator.com/item?id=10111479)

------
Al__Dante
If you want to learn a functional language, Lisp is a good choice. It has been
around a long, time, so it is stable and well supported, and it is also the
basis for many other languages. Haskell, while also an excellent language, is
more niche.

Deciding whether to learn a language or learn how to write a compiler is more
difficult. If you are struggling with the Dragon book, have you condidered
"Modern Compiler Implementation in ML"? Although ML is even more niche than
Haskell, it is a functional language and the book takes you step-by-step
through the process of writing a compiler for (a subset of) it.

~~~
thegenius2000
Interesting, let check out "Modern Compiler Implementation in ML", perhaps I
can start with that and then move to the Dragon Book when I'm ready for it.

------
bribri
Learn Haskell, it significantly changed the way I think about programming and
those new perspectives have been applicable in the other languages I've
written in. Lisp is good, but I think Haskell will broaden your horizons more.
The only problem is Haskell is really hard to learn and there aren't a ton of
good learning resources. I suggest learning a simpler, similar language Elm,
to start thinking functionally, and then move on to Haskell.

------
merqurio
Based on the experience of a friend of mine, Lisp. He first learnt the
language, managed to do cool stuff and the he wrote his own compiler. It's
been a nice journey from outside, I'm sure it was even better for him!

------
TurboHaskal
It doesn't matter. Whichever you choose of those three will turn you into an
unemployable mess.

~~~
thegenius2000
Not quite sure I understand what you mean by _an unemployable mess_ , i.e. do
you mean this positively, or negatively, if you get what I'm asking?

