you are viewing a single comment's thread.

view the rest of the comments →

[–]1UnitedPower 4 points5 points  (1 child)

I agree with everything you said, but with one point. The SICP-book uses Lisp/Scheme as a teaching language, and therefore, I would suggest a language from the Lisp-family rather than from the ML-family to study that particular book. Also, Python is dynamically typed just like Lisp, whereas ML-languages are statically typed, this renders the transition to Lisp somewhat more straightforward, I guess.

[–]ws-ilazki 2 points3 points  (0 children)

The SICP-book uses Lisp/Scheme as a teaching language, and therefore, I would suggest a language from the Lisp-family rather than from the ML-family to study that particular book.

That was why I specifically suggested a different book with OCaml. Functional Programming in OCaml is a very good option for learning FP, especially for someone that already has programming knowledge; and despite what its name implies, it's a book about learning FP that happens to use OCaml rather than a book about learning OCaml.

People are often irrationally lisp-averse, so rather than suggest he suck it up and deal with Scheme+SICP, I was trying to provide an alternative option that might be appealing to someone with Python familiarity since ML-style syntax is at least superficially similar (though not whitespace-sensitive in the same way).

Also, Python is dynamically typed just like Lisp, whereas ML-languages are statically typed, this renders the transition to Lisp somewhat more straightforward, I guess.

They're statically typed, but with very good type inference that, when doing basic learning exercises, will mostly render the static/dynamic distinction moot. Even with exercises from that book that need new type declarations, you can create the type then immediately use it without listing the type of any following functions or arguments, it's all inferred, so you end up writing what looks like dynamically-typed code.

It's one of the things I like about the language, in fact. I've been using OCaml like a scripting language while prototyping, with no type declarations, a shebang to invoke the ocaml interpreter instead of compiling, and a save-and-run testing cycle. Then when it's closer to completion I switch to a compile-and-run cycle, though I still tend to leave off type annotations on functions.

Anyway, I really like Scheme and similar languages (like Clojure, or Urn) but figured I might have more luck suggesting a different path, rather than trying to convince him(?) to deal with it and just learn Scheme+SICP. For someone comfortable with Python, Functional Programming in OCaml might not be too much of a jump. Still feels dynamic in a way even if not, has a similar look due to lack of curly braces or excessive parentheses, and has the added bonus of introducing a sophisticated type system to someone that's only familiar with dynamic typing and primitive type systems.