A good F# codebase to learn from [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
开发者_运维技巧 Improve this questionI've been teaching myself F# for a while now. I've read Programming F# by Chris Smith (great book) and I've written a few small scripts for getting the job done here and there.
But IMO the best way to learn a new programming language—and more importantly, the idioms that come with it—is to read a good open source codebase written in that language. Naturally, writing code in that language is crucial, but in the beginning, you're basically struggling with your own ignorance about how things should be done. You could perform certain tasks one way or the other, but it takes experience to realize the flaws and virtues of each. Even after you've gotten a firm grasp of how things work, reading the code of people who have an even firmer one helps a great deal.
Most would agree that the most insightful parts of any learn-a-programming-language book are the code examples, and reading a well-written open source codebase is the next level of that.
So are there any out there for F#?
Ref this question.
IMO, F# PowerPack is the best code base there.
Here are a few additional links that you may find interesting:
If you download F# for Visual Studio 2008, it also comes with sources of the entire F# library. This is sometimes a bit difficult code and it uses some internal tricks in a few places, but it is sometimes very good resource for learning (for example,
Map
type is a great example of a tree data structure).There are some official F# Samples and some F# Community Samples (which includes my 3D fractal, example of working with quotations and a few shorter examples).
You can also look at the source code of samples from my Real-World Functional Programming book. Especially later chapters contain relatively complex sample applications (parallel simulations of animas, rectangle drawing application, etc.) The code has quite a lot of comments, so this may be useful for learning F#.
I would say that the WPF F# control codebase at http://wpffsharp.codeplex.com/ is a good place to start. One of the least trivial aspects of F# is UI and this is an excellent start to UI in F#. Also, since the code base is written by someone also learning F#, you have the benefit of seeing the iterations they go through.
精彩评论