Good projects to learn OCaml and F# [closed]

倾然丶 夕夏残阳落幕 提交于 2019-12-03 02:10:40

问题


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.


回答1:


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




回答2:


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. ;-)




回答3:


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




回答4:


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."

  • Trie-ing to optimize text search in F#
  • How to really be an evil genius (with F#)
  • DAWG-fight, Optimizing text search in F# II
  • DAWG-Gone!
  • The BookWorm challenge



回答5:


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.




回答6:


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




回答7:


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



来源:https://stackoverflow.com/questions/2019549/good-projects-to-learn-ocaml-and-f

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!