25

After learning the basic syntax, reading some non-trivial code is a fast way to learn a language. We can also learn how to design a library/software during reading others' code.

I have following lists.

  1. A Chess program in OCaml by Tomek Czajka.

  2. Hal Daumé has written several machine learning libraries in Ocaml. Including decision trees, logistic regression and SVM. All of them are near-production-quality code.

  3. A Chess Game Analysis program in F# in Microsoft Research.

The above three are my favorites. Will you suggest some other sources? General purpose open source software are good, specialized open source like the three I list here are even more welcome.

Community
  • 1
  • 1
Yin Zhu
  • 16,980
  • 13
  • 75
  • 117
  • http://stackoverflow.com/questions/383848/f-open-source-projects – Mauricio Scheffer Jan 07 '10 at 13:12
  • @Mauricio Thanks for the comment. I think the two threads have some difference, as here the languages are Ocaml and F#, not single F#. And the list is not only for open source, but also for some code sinppets or acadmic codes. – Yin Zhu Jan 07 '10 at 13:58
  • Hal Daumé's software has been relocated to [http://www.umiacs.umd.edu/~hal/software.html](http://www.umiacs.umd.edu/~hal/software.html). – Thorkil Holm-Jacobsen Jan 16 '13 at 21:03

7 Answers7

17

Jean-Christophe Filliâtre's page has numerous programs and libraries in OCaml.

Pascal Cuoq
  • 79,187
  • 7
  • 161
  • 281
12

One of the less well covered aspects of OCaml is the higher-order module system. The ocamlgraph library is an excellent example of benefiting from this language feature.

You may also like to read the OCaml source code to my HLVM project. The source code from my book OCaml for Scientists (2005) is freely available here but not open source. However, it has not been updated for several years and you can probably do much better today!

MLDonkey was an early file sharing client that once had hundreds of thousands of users. This is a heavily concurrent open source application written entirely in OCaml, weighing in at around 171,000 lines of code.

The Unison file synchronizer is another open source utility application written entirely in OCaml, weighing in at 24,000 lines of code. This was also the first popular application written in an ML derivative to have used asynchronous IO. So all of the F# code doing async today is essentially derived from it.

FFTW is a code generator for fast Fourier transforms (FFTs), essentially a very specialized form of optimizing compiler, that has been widely adopted and licensed for commercial use, e.g. in the core of MATLAB. Written mostly in OCaml with quite a bit of C and weighing in at 14,000 lines of OCaml code.

You may also like to read the source code to Hevea and ANT as these are fairly classical application domains for OCaml but also production quality applications with thousands of users.

I cannot think of any open source F# code to recommend. There is precious little out there and it is generally very poor quality. Most of it reads like Haskell. ;-)

J D
  • 48,105
  • 13
  • 171
  • 274
5

Janes Street has released several libraries here. They're actually using OCaml in an industry setting. If anything, I'd check these out.

wheaties
  • 35,646
  • 15
  • 94
  • 131
3

Check out these series of blog entries on Bookworm problem, they are light-hearted and show F#'s multiparadigm-ness very well. The last one looks like most "functional."

Chang Chung
  • 2,307
  • 1
  • 17
  • 16
2

Well, Unison has been recommended to me to have a look at, as well as solving various problems from Project Euler, but personally I get more done by writing my own practical programs, so I'll probably be adapting one of those into OCaml, to see how it goes.

Noon Silk
  • 54,084
  • 6
  • 88
  • 105
1

You have the source of the ocaml standard library which is in o'caml.

I guess you've already looked at it, but the caml hump is a good source too: Here

LB40
  • 12,041
  • 17
  • 72
  • 107
0

For web based Ocaml code Opa has open sourced all there code as well.

cameron
  • 81
  • 6