
Ask HN: Beginner Programmer: Haskell Book or SICP? - deftturtle
The extent of my programming involves MIT&#x27;s Scratch, AppInventor, calculator games for TI83, some limited Javascript &amp; Python from Codecademy, some HTML&#x2F;CSS, and some CLI experience.<p>I&#x27;d like to learn programming &amp; computer science, so I&#x27;m taking an intro programming class (CS 161), which uses Python. However, I want to do some learning before the class starts, and I bought the Haskell Book [1] about 2 years ago. I&#x27;ve completed the first 5 chapters. People highly recommend SICP [2], so I&#x27;m wondering if I should do them concurrently, or just pick one. I&#x27;d like to continue with Haskell, but if I&#x27;d be better off with SICP, especially for the Python class, then I don&#x27;t mind putting Haskell on hold.<p>From reading HN over the years, I&#x27;ve gathered that many people believe functional languages better suited to learning CS. So I&#x27;m apprehensive about diving into Python and not grounding myself or exposing myself to functional disciplines.<p>Thank you for any advice<p>[1] Haskell Book - http:&#x2F;&#x2F;haskellbook.com&#x2F;<p>[2] SICP - https:&#x2F;&#x2F;mitpress.mit.edu&#x2F;sites&#x2F;default&#x2F;files&#x2F;sicp&#x2F;full-text&#x2F;book&#x2F;book.html
======
madhadron
For functional versus imperative programming, don't worry about it. Learn
structured, imperative programming in Python. It's a core skill and one of the
deep mathematical structures of the field. Learn Haskell or Scheme as you have
time and interest. (I say that as someone who was at one point somewhat known
for my Haskell work.)

More important than worrying about learning resources is to 1) produce working
code and 2) read other code to learn how to improve. It's more like learning
to play music. If you don't have the basics of your instrument and ear under
control, deep theory and sophisticated analysis do you little good.

So try to produce programs that solve day to day problems for you, even if
they're awkward. Read the code for the libraries you use or the Unix command
line utilities.

~~~
afarrell
I agree: If you are taking a class in python, then its really better to first
ground yourself in python. Python is also a great first language to learn. But
some people find good books really useful. Here are two:

[https://greenteapress.com/wp/think-
python-2e/](https://greenteapress.com/wp/think-python-2e/)

[https://automatetheboringstuff.com/](https://automatetheboringstuff.com/)

> So I'm apprehensive about diving into Python and not grounding myself or
> exposing myself to functional disciplines.

I wouldn’t be. You can learn FP at the start of 2020.

------
quantified
Too bad you’re only choosing one.

Haskellbook is my favorite for Haskell. I’ve read 3 different Haskell books,
it’s the clearest and has the fewest “and now a miracle occurs” sections.

SICP drops you into more involved engineering domain tooics fairly quickly. It
really helps to be able to keep pace with them. I tried working through SICP
in Clojure and it wasn’t awful.

For my money, I’d work on Haskell first. It’s great training for understanding
types as well as FP, and the concepts mostly translate to other languages like
F# and OCaml. It’ll help you reason better in a variety of other languages.

------
Mxtetris
You may want to hold off on both. SICP uses Scheme, a dialect of Lisp. Neither
it nor Haskell closely resembles Python, and the differences may confuse
rather than illuminate.

That said, once you're done with your class, by all means give them a look.

------
CyberFonic
I would recommend understanding computer architecture first. The basics of
CPUs, memory, I/O and instruction sets. Once you understand the "host"
environment which is very real, being cast into silicon, you are in a better
position to understand how languages provide you with abstractions for using
those resources.

Personally I would recommend SICP since it will introduce you to concepts
which are also in the Haskell book. But SICP with Scheme covers a far wider
range of abstractions.

Python is a good first language because you can program in pure functional or
pure object-oriented forms and by combining the two recognise where one or the
other is the most effective abstraction to employ.

In practice I like to define objects which I then use in a functional manner.
If you read the specifications for Scheme, you will discover that the
functional operations on objects is the most fundamental paradigm that is
being used. cf pages 3 & 5 "The Scheme of Programming Language - second
edition".

------
BWStearns
I'm echoing others when I say both! But I know we all have limited time.

For my part I'd just say either would be a great choice. One thing to keep in
mind is that if this is your first experience with programming is that you
will likely be learning something OOP-ish in class, whereas the books are
focused on functional programming.

If you do dive into one or both of these books remember that there's more than
one way to approach the underlying objectives that FP solves. After learning
an FP approach some iterative/OOP approaches can feel alien, but they're still
valid and widely used and that's likely what you'll be learning. I learned OOP
first but prefer FP, YMMV, but learning both is always good.

------
a-saleh
I wouldn't stress about that as much. I.e. I learned programming in Visual
Basic for Applications (i.e. did you know Excel 97 had a full-fledged VB6 ide
hidden behind a short-cut? ALT-F11 if I remember correctly) and while I could
argue that functional language would have been a better entry-point (I
remember having problem understanding the meaning of 'x=x+1'), in the end it
was fine.

To your point about functional being better for CS, I am not sure, i.e. when I
had class on basics of algorithm design, we went through "Introduction to
Algorithms" book and the pseudo-code looked much more like Python or Pascal
than scheme/haskell/ml. So if you stick to python, you will be fine.

In the end, you already dabble more than four programming languages, I am the
sort of a person who prefers breadth of knowledge to depth so I would go
through ALL OF THEM :P

(This reminds me I am still only on page ~50 of SICP and I really wanted to
return to that)

------
sosilkj
Some great comments here. If you are focusing on Python, here are a couple
other suggestions that you might find useful:

Functional Programming In Python free O'Reilly book:
[http://www.oreilly.com/programming/free/files/functional-
pro...](http://www.oreilly.com/programming/free/files/functional-programming-
python.pdf)

Composing Programs, which is somewhat based on SICP, but for Python:
[https://www.composingprograms.com/](https://www.composingprograms.com/)

------
chokolad
[3] Algorithms and Data Structures by Nicklaus Wirth
[https://www.amazon.com/Algorithms-Data-Structures-Niklaus-
Wi...](https://www.amazon.com/Algorithms-Data-Structures-Niklaus-
Wirth/dp/0130220051)

------
thiago_fm
Try to get a job where you can do scala/another FP language, gosh, even
Ruby/Python/Javascript has good functional constructs and have ways of writing
functional code. As they are languages you might know, learn how to explore FP
on those langs to the maximum.

I wouldn't overvalue LISP or Haskell, just because it is something that you
aren't so used to, or that it gets frequently cited here in HN. I particularly
like the SICP book , but think it is a bit silly how some people overvalue
this.

------
AnimalMuppet
> From reading HN over the years, I've gathered that many people believe
> functional languages better suited to learning CS.

I disagree with this premise. Yes, there is strong FP advocacy on HN, but I
don't think the consensus advice here would be "functional programming is
better suited to learning CS". Even more, I don't think the consensus would be
that FP is the best way to program.

That said, learn FP. But also learn imperative programming. And learn when
each is the best tool for the job.

------
crimsonalucard
I'm going to disagree with most of the commenters here.

Start with Haskell.

"Data dominates. If you've chosen the right data structures and organized
things well, the algorithms will almost always be self-evident. Data
structures, not algorithms, are central to programming." -Rob Pike

Sicp is great. But sicp won't elucidate the above fact to you which is central
to modern programming. Modern programming is about managing things that are
complex beyond the ability for a human to comprehend completely.

Too many programmers are concerned with the details. What's even more alarming
is that most programmers say they test for how detailed a person is in a time
limited programming interview.

Your ability to be detailed will never be able to scale with the complexity of
programs so greater ability to be detailed doesn't lead to any benefites in
the long run.

To build robust applications you must be able to ignore details.

Learning Haskell will teach you how to ignore details by eliminating detail as
a rule. Counterintuitively, Haskell is much less detailed then scheme, python
or almost every other popular language out there. I am not referring to syntax
here, I am referring to the amount of ways to go from A to B. Haskell makes
this dichotomy more evident and the algorithm that takes you from A to B less
relevant. Haskell is more restrictive and less expressive, and restriction is
power.

Haskell does have issues though, that being the nature of side effects. The
abstractions to deal with such things are so mind bending that it might not be
good to dive too deep into the world of categories. It depends. But the main
point you want get from learning Haskell has to do with the Rob Pike quote
above. Once you understand that you'll be better then 99 percent of other
programmers on the things that are relevant to modern programming. Then if
you're interested you can continue further into Haskell or jump to Sicp as you
got the main point.

The study of Haskell eventually leads to category theory which almost looks
like a formal theory of abstraction of systems and modules which alludes to
the possibility of 'deriving' programs rather then using our gut to 'design'
them. It's mind opening to go further but not critical.

Ironically Rob Pike is part of the golang team which is a language that
hinders your ability to express all forms of data structures. Json cannot be
properly described by the type system of that language so while his quotation
is correct I don't agree with many of his decisions.

------
pgustafs
Just do whichever one is more interesting to you. If you like the Haskell,
keep going. There's plenty of time to do SICP after Haskell. If you're bored
with Haskell, try SICP or whatever strikes your fancy. The limiting factor for
learning is interest not time.

------
macando
I'd say Haskell. But please read 'Clean Code' by Robert Martin as well. By
reading the first 10 chapters (you can go through them in 2-3 days) you'll be
automatically better than 50% of the professional developers out there.

------
deepaksurti
If you have the time , work through SICP and do all it’s exercises in both
Python and Haskell.

------
kerkeslager
I don't think there's much difference whether you learn Haskell or Scheme or
Python first.

However, I think of the resources available, SICP is by far the most
accessible and enlightening book for a beginner. I'd go with that.

------
SamReidHughes
It doesn't really matter, the main consequence is how efficiently you spend
you time. I'd keep going with the Haskell book unless you hit a wall or lose
interest. You are using it to actually make stuff, I hope.

------
allenleein
Choose either one of them to fully understand it, then you will find another
one is not as hard as you thought.

------
p1esk
What do you want to build?

~~~
deftturtle
Interested in websites, robotics, cryptography, and automating stuff.

~~~
catacombs
Python sounds like a good fit for your interests.

