I'd like to learn programming & computer science, so I'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've completed the first 5 chapters. People highly recommend SICP [2], so I'm wondering if I should do them concurrently, or just pick one. I'd like to continue with Haskell, but if I'd be better off with SICP, especially for the Python class, then I don't mind putting Haskell on hold.
From reading HN over the years, I've gathered that many people believe functional languages better suited to learning CS. So I'm apprehensive about diving into Python and not grounding myself or exposing myself to functional disciplines.
Thank you for any advice
[1] Haskell Book - http://haskellbook.com/
[2] SICP - https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html
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.
https://greenteapress.com/wp/think-python-2e/
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.
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.
That said, once you're done with your class, by all means give them a look.
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".
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.
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)
Functional Programming In Python free O'Reilly book: http://www.oreilly.com/programming/free/files/functional-pro...
Composing Programs, which is somewhat based on SICP, but for Python: https://www.composingprograms.com/
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.
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.
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.
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.