Hacker News new | past | comments | ask | show | jobs | submit login
Teaching OCaml (ocaml.org)
91 points by lelf on Nov 13, 2014 | hide | past | favorite | 31 comments



I'm surprised EPITA (France) is not on the school list. OCaml is the first language you learn there. Fantastic introduction to algorithms.


you can add it, here's the link to the file on Github : https://github.com/ocaml/ocaml.org/blob/cd7186176a11c860ef35...


Is there a reason you're pointing to a specific commit? The link below is to the current version.

Also note that it's easy to make quick edits in GitHub's web interface without having to clone the repo locally. It works well and we get a lot of quick fixes this way.

https://github.com/ocaml/ocaml.org/blob/master/site/learn/te...


I don't link to branches because if the file gets moved (which it very frequent especially for doc), the link goes 404.

Think of it as a use-after-free :)

Blobs are mostly immuable and you have to edit in a fork anyway, unless you have rights to the repo.


So many functional languages. Which one to learn? Haskell? OCaml? F#? Scheme? Common Lisp? Clojure?


Learn more than one. I would suggest, in no particular order, at least one from each of these three groups:

Static, strict-by-default ML derivatives (Standard ML, F#, Ocaml, AliceML, etc.)

Static, lazy-by-default ML-inspired (Haskell, probably others, but, really, Haskell).

Dynamic Lisp-family languages (Racket, Scheme, Common Lisp, Clojure)


I would add a Logic Programming language like Prolog to the list.


Isn't Prolog considered a "declarative" language?


Yes, but it complements functional programming.

Plus it helps to understand how those logic programming libraries, like mini-Kanren, core.logic among others work.


Functional and declarative aren't mutually exclusive -- in fact, functional languages are generally considered to be declarative.


How about w.r.t. the 'biggest bang for the buck'?


For a practical language I'd pick either F# or Clojure, depending on whether you like static or dynamic typing.


Somewhat of an erlang fanboy but...

Erlang!


1 would like to recommend the lecture notes [1] used in CS3110 at Cornell to people who want to learn OCaml. They have been used and revised over the years and are of very high quality.

[1] http://www.cs.cornell.edu/Courses/cs3110/2014sp/lecture_note...


In the "suggested textbooks" section, #3 is Real World OCaml which has Jason Hickey as an author and is available for free online, and #4 is Jason Hickey's notes for a course, is marked "Draft. Do No Redistribute", and at first glance its table of contents looks similar to Real World OCaml.

Isn't the latter redundant and in violation of whatever?


There is no shared text at all between Real World OCaml and Jason Hickey's course notes. We wrote the RWO content from scratch due to the different style (O'Reilly vs academic) and set of libraries used.


FCT UNL (Portugal) should probably be in the list.

Back in the mid-90's they were teaching Caml Light. Most likely they are on OCaml nowadays.

The CS department is very strong in FP and LP languages and theory.


Is there a link you can point us at? If it's in portugese we might have trouble understanding it.


My post was in the hope that some else might have better info as me, and comment on it.

Due to Bologna, the older pages are now gone. I can try to contact some of my former teachers to find out the current set of languages.


Ah, CS 3110. The bane of every Cornell Comp Sci majors existence.


It made me think deeply about my decision to be a CS major and in the end I am grateful. It became one of my favorite classes at Cornell.


Could you elaborate?


I think "all of Ocaml compiles to JS " is a bit optimistic. AFAIK, code using Jane Street's Core stdlib doesn't work. But a lot of Ocaml code should be fine.


All of the core compiler library does compile to efficient JavaScript. For instance, see the IOCamlJS interactive notebooks that embed the entire compiler in the browser with a web UI. Just press the play button:

- http://andrewray.github.io/iocamljs/oh261.html (H.261 video decoding)

- http://www.ujamjar.com/hardcaml/ (HardCaml RTL hardware description language, similar to Chisel in Scala)

- http://gazagnaire.org/fuconf14/ (building a 2048 game implementation)


He was talking about Jane Street's replacement stdlib. I heard Core_kernel can be compiled to JS though.


This is because Core relies on OS/FFI. I think as long as it isn't using OS/FFI it can compile, although I may be wrong on that count.


> OCaml is a high-level language that supports […] object-oriented programming style

AFAIK OCaml only support records, which are like C’s structs.

Edit: no, it has real objects, as stated in comments below.


OCaml has a sophisticated object system. See:

https://realworldocaml.org/v1/en/html/objects.html

You can do a lot of traditional 'OO'-style things with functors and modules, though, so you don't need objects necessarily to get a lot of OO features.


OCaml is (somewhat unconventionally) object-oriented; it has classes, inheritance, what-have-you. The 'O' in the name stands for "objective". Perhaps you're thinking of SML?

See: http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual005.ht...


Just looking at the table of contents here

http://caml.inria.fr/pub/docs/manual-ocaml/objectexamples.ht...

seems to state otherwise. That said, I think the common advice is to not use most of that and to restrict yourself to just records as they are almost always the better choice.


F# is the way to go after the recent Microsoft announcements about .NET.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: