Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to learn OCaml efficiently? [closed]

Ok, I am a Java programmer without any functional programming knowledge.

Now I have been currently learning OCaml for 2 weeks, and I don't get even a clue about OCaml.

There are several tutorials and books suggested here:

https://stackoverflow.com/questions/2073436/ocaml-resources

but none of them seems friendly. Really, I mean it.

None of the tutorials or books at least gives me a Hello World quick start. after two weeks, I even don't know what is the program entrance of Ocaml (such like a main()).

I even have no idea of how to really write OCaml codes into a file, and somehow let OCaml compile it.

Ok, complaints are finished.

I have to learn it and do it well. So, could you please give me some suggestions of learning it? I feel OCaml is very obscurity and hard to understand. Please enlighten my road.

like image 882
Jackson Tale Avatar asked Nov 22 '12 13:11

Jackson Tale


People also ask

Why is OCaml so hard?

Problems. We have observed that OCaml is really hard for beginners to learn without help. The main cause is the terribly poor reporting of static and dynamic errors. We describe a few striking examples below.

Why is OCaml not popular?

The only problem with OCaml is that not many people know how to code in it, and therefore not many people use it.

Is OCaml purely functional?

ML-derived languages like OCaml are "mostly pure". They allow side-effects through things like references and arrays, but by and large most of the code you'll write will be pure functional because they encourage this thinking.

Why do people like OCaml?

The main advantages of OCaml are its functional nature, readability (it reads almost as nicely as a dynamic language like Python), reliability, but mostly speed. OCaml is much, much faster than most people believe - it's C fast (actually slightly slower than C, but many, many times quicker than dynamic languages).


2 Answers

Did you try TryOCaml website ? It can be a good start.

like image 155
Çağdaş Bozman Avatar answered Oct 14 '22 19:10

Çağdaş Bozman


I first met OCaml 4 years ago and I needed to add some little features to existing student's project at the University. I started from OCaml tutorial and I understood how awesome this language is. Then I tried to write more or less big programs in OCaml and started to ask the community questions. From my experience I think you need the same thing. Pick up a favourite area of programming (web, unix tools, graphics & games, desktop applications), take a project which is not too big or complicated for your first application. I think the OCaml community can help you to decide. You can reach them in maillist but I prefer Freenode IRC server more. And then just write some code and if something is strange ask!

Best wishes, Kakadu

P.S. I hope OCaml will be your next big love as it has become for many of us.

like image 28
Kakadu Avatar answered Oct 14 '22 20:10

Kakadu