Hacker News new | past | comments | ask | show | jobs | submit login

OCaml is the coolest language I’ve ever used. It’s the backbone of Harvard’s Intro to CS II, where they explain programming language paradigms with a heavy emphasis on the functional. OCaml’s expressiveness really shines through - I remember fondly how small yet powerful the language feels.

Unfortunately, I don’t know what to build with it... I’m the kind of person that builds projects for professional advancement, which curtails my creativity. I’ve thought of making a simple web server. Or maybe learning ReasonML. Any suggestions welcome.




OCaml really shines when your problem is data in, data out, and the transformation is non-trivial. So, maybe try compiling or generating stuff. I have two examples of my own: USSM¹, a simple static web site generator, and Monokex, a secure handshake generator like the Noise explorer (except much smaller, much simpler, and very incomplete).

[1]: http://loup-vaillant.fr/projects/ussm/

[2]: https://github.com/LoupVaillant/Monokex


>OCaml really shines when your problem is data in, data out, and the transformation is non-trivial.

So do you think it would be a good choice for creating a make-like tool, in which you want to support doing transitive / hierarchical makes, like target A depends on B, and B on C, so if C is newer than A, the tool should build B from C and then A from B, and other such variations?

Working on such an idea, currently in Python, and have an interest in and am reading about OCaml, hence asking. I think the work may involve a topological sort.


You should check out at least a couple of things:

- The Dune build system for OCaml, also written in OCaml, does exactly what you are describing: https://dune.build/

- Jane Street's Incremental library lets you build auto-updating computations which change whenever their inputs change: https://github.com/janestreet/incremental

Honourable mention: Thomas Leonard's really interesting series where he describes rewriting his dependency management tool, 0install, from Python to OCaml http://roscidus.com/blog/blog/2014/06/06/python-to-ocaml-ret...


Thanks for those links, will check them out. Took a quick look at Dune. Interesting that the simple examples I saw seem to use a Lisp-like syntax.

The Jane Street Incremental library idea sounds cool. I had thought of something very roughly like it, but for memory data, recently, in connection with that tool I'm working on.

Had come across Leonard's series of moving 0install from Python to OCaml earlier. Need to revisit it.


Yeah Dune uses s-expressions as its config format. It was born out of work done by Jane Street, and they like using s-exprs there.


Yes, that's the kind of thing I'd reach Ocaml for.


Great, thanks.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: