What's a good beginning text on functional pro

2019-03-07 13:36发布

问题:

I like to study languages outside my comfort zone, but I've had a hard time finding a place to start for functional languages. I heard a lot of good things about Structure and Interpretations of Computer Programs, but when I tried to read through it a couple of years ago it just seemed to whiz over my head. I do way better with books than web sites, but when I visit the local book store the books on LISP look kind of scary.

So what's a good starting point? My goal is to be able to use a functional programming language to solve simple problems in 6 months or so, and the ability to move to more advanced topics, recognize when a functional language is the right tool for the job, and use the language to solve more problems over the course of 2-3 years. I like books that are heavy on examples but also include challenges to work through. Does such a thing exist for functional languages?

回答1:

The Little Schemer teaches recursion really well, and it's fun and simple to read.

I also liked The Scheme Programming Language for a broader introduction into the language.



回答2:

Try Real World Haskell. It's free online.



回答3:

SICP is a great book.

This is probably my bias, but I thought ocaml was pretty easy to get into. You have the option of programming in a few different styles until you're completely comfortable. I posted a bunch of links to Haskell and Ocaml references that are books, with examples et cetera that seem right up your alley.

If you prefer Lisp, you can try to power through the 99-problems in Lisp(which you can do in any language, really), or you can watch the lectures from the people who wrote SICP.

Further down the road, get a hold of "Purely Functional Data Structures", as it'll get into the hard-core deep design and considerations you have to take into account in functional languages --it uses ML (which ocaml derived from).



回答4:

I really recommend "On Lisp" from Paul Graham.

It is concise and very readable even for beginners in functional programming (as I was when I read it). It contains a lot of very short examples, each which helps to understand one single thing.

I often thought reading this book: this is just the language containing exactly the features I ever wanted in other (nonfunctional) languages, but never got. :-( And this is exactly the book to learn it, always comprehensible, sometimes even funny!

You may get it for free at the author's site!



回答5:

I really like Thompson’s “Haskell: The Craft of Functional Programming” because it’s well written and Haskell allows an easier start than other functional languages while being completely pure (unlike Lisp or Scheme).



回答6:

Since there are a bunch of different functional programming languages, it's hard to recommend books. But if you're interested in Common Lisp, recently I've been reading "Practical Common Lisp" by Peter Seibel, which you can check out online for free before dropping your hard earned cash on it. It's a pretty gentle introduction to CL, with great explanations and tons of examples. Seibel's a great writer (example: read the story of Mac,) he's good at keeping you engaged, which is really where SICP falls down, I think. It's just so dry! But while Practical Common Lisp is pretty example-heavy, it doesn't really have challenges to work through, although the examples are mostly designed to let you continue to work and build on them.

Another good book, this one Scheme-oriented: How to Design Programs. (Online) I haven't had as much time with this book, being more of a Lisper than a Schemer myself, but it's well written, has good explanations and examples, and has lots of exercises to work on. It seems pretty popular in the Scheme crowd.



回答7:

The Schemers Guide and related software - seriously good stuff

http://www.schemers.com/tsg.html



回答8:

Check out Introduction to functional programming. It offers a different perspective.



回答9:

I found The Little Schemer a great, great introduction to functional programming. It's entirely based on simple, bite sized examples which are built up upon as the book goes on.



回答10:

I learned from Jeffrey Ullman's Elements of ML Programming, which is pretty good. It loses points for being about Standard ML, when OCaml, F#, and Haskell are (seemingly) more popular.



回答11:

I feel Purely Functional Data Structures by Chris Okasaki is worth a look.

FYI http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf



回答12:

Haskell is a very good functional programming language for beginners. Someone had asked about good resources for Haskell, so I will point you there.

If you are looking for a good book on Functional Programming, I would recommend "Functional Programming: Practice and Theory" by Bruce J. Maclennan.
It is however required that you brush up on your Set Theory and Logic before giving it a read. It includes examples in LISP, Haskell and other languages.



回答13:

If you have experience with .NET, Expert #F is good.

F# is derived from OCaml. Lisp is more pure as functional languages go.



回答14:

Real-World Functional Programming (with examples in F# and C#)



回答15:

I have heard good things about Haskell Functional Programming, but I also found this list of functional programming books at amazon that might be helpful to you.