• en

OCaml Planet

The OCaml Planet aggregates various blogs from the OCaml community. If you would like to be added, read the Planet syndication HOWTO.

926 blog posts are available. You can read the 30 more recent ones below or view older ones.

Weekly News — OCaml Weekly News, Apr 26, 2016

  1. Question about Optimization
  2. OCaml release 4.03.0
  3. Other OCaml News

Full Time: Software Developer (Functional Programming) at Jane Street in New York, NY; London, UK; Hong Kong — GitHub Jobs, Apr 25, 2016

Software Developer

Jane Street is a proprietary quantitative trading firm, focusing primarily on trading equities and equity derivatives. We use innovative technology, a scientific approach, and a deep understanding of markets to stay successful in our highly competitive field. We operate around the clock and around the globe, employing over 400 people in offices in New York, London and Hong Kong.

The markets in which we trade change rapidly, but our intellectual approach changes faster still…

Read more...

Oh! Pascal! — Shayne Fletcher, Apr 21, 2016

I can't help but want to share my joy at coming across this pearl of a program from the "Pascal User Manual and Report" - Jensen and Wirth (circa 1974). In my edition, it's program 4.7 (graph1.pas).

This is it, rephrased in OCaml.


(* Graph of f x = exp (-x) * sin (2 * pi * x)

Program 4.7, Pascal User Manual and Report, Jensen & Wirth
*)

let round (x : float) : int =
let f, i =
let t = modf x in
(fst t, int_of_float@@ snd t) in
if f = 0.0 then i
else if i >= 0 then
if f >= 0.5 then i…
Read more...

Weekly News — OCaml Weekly News, Apr 19, 2016

  1. Initial Release of OCI, a framework for continuous integrations and benchmarks
  2. Core Suite 113.33
  3. Ocaml Github Pull Requests
  4. Other OCaml News

Unboxed floats in OCaml — LexiFi, Apr 14, 2016

This post describes how unboxing for float values works in OCaml, focusing on recent evolutions. Most of the content here applies to boxed integer types as well (int32, int64 and nativeint).

read more

OCaml server-side developer at Ahrefs Research (Full-time) — Functional Jobs (FunctionalJobs.com), Apr 14, 2016

Who we are

Ahrefs Research is a San Francisco branch of Ahrefs Pte Ltd (Singapore), which runs an internet-scale bot that crawls whole Web 24/7, storing huge volumes of information to be indexed and structured in timely fashion. On top of that Ahrefs is building analytical services for end-users.

Ahrefs Research develops a custom petabyte-scale distributed storage to accommodate all that data coming in at high speed, focusing on performance, robustness and ease of use. Performance-critical low…

Read more...

Announcing the upcoming Frama-C Day 2016. — Frama-C, Apr 14, 2016

Senior Software Engineer (Haskell) at Front Row Education (Full-time) — Functional Jobs (FunctionalJobs.com), Apr 13, 2016

Position

Senior Functional Web Engineer to join fast-growing education startup transforming the way 3+ million K-8 students learn Math and English.

What you will be doing

Architect, design and develop new applications, tools and distributed systems for the Front Row ecosystem in Haskell, Flow, PostgreSQL, Ansible and many others. You will get to work on your deliverable end-to-end, from the UX to the deployment logic.

Once you're an integral part of the team you will act as Dev Lead and…

Read more...

Dictionaries as functions — Shayne Fletcher, Apr 13, 2016

This is an "oldie but a goodie". It's super easy.

A dictionary is a data structure that represents a map from keys to values. The question is, can this data structure and its characteristic operations be encoded using only functions?

The answer of course is yes and indeed, here's one such an encoding in OCaml.


(*The type of a dictionary with keys of type [α] and values of type
[β]*)
type (α, β) dict = α -> β option

(*The empty dictionary maps every key to [None]*)
Read more...

Weekly News — OCaml Weekly News, Apr 12, 2016

  1. ppx_deriving_morphism 0.2

Coq 8.5pl1 is out — Coq, Apr 10, 2016

Version 8.5pl1 of Coq is available. It fixes several bugs of version 8.5, including one critical bug. It also brings various performance improvements. More information can be found in the CHANGES file. Feedback and bug reports are extremely welcome.

Weekly News — OCaml Weekly News, Apr 05, 2016

  1. Tensorflow bindings for OCaml
  2. the latest obuild (v0.1.8) supports ppx
  3. 4.03.0+beta2
  4. qtest 2.2, merged with qcheck
  5. Other OCaml News

C++ : Streams — Shayne Fletcher, Apr 03, 2016

In this blog post, types and functions were presented in OCaml for modeling streams. This post takes the action to C++.

First, the type definition for a stream.


struct Nil {};
template <class T> class Cons;

template <class T>
using stream = sum_type <
Nil
, recursive_wrapper<Cons<T>>
>;
The definition is in terms of the sum_type<> type from the "pretty good sum" library talked about here.

The definition of Cons<>, will be in terms of "thunks" (suspensions…

Read more...

Rotate — Shayne Fletcher, Apr 02, 2016

Rotate

This post is inspired by one of those classic "99 problems in Prolog".What we are looking for here are two functions that satisfy these signatures.


val rotate_left : int -> α list -> α list
val rotate_right : int -> α list -> α list
rotate_left n rotates a list $n$ places to the left, rotate_right n rotates a list $n$ places to the right. Examples:

# rotate_left 3 ['a';'b';'c';'d';'e';'f';'g';'h'] ;;
- : char list = ['d'; 'e'; 'f'; 'g'; 'h'; 'a'; 'b'; 'c']

# rotate_lef…
Read more...

ASM.OCaml — OCamlPro, Apr 01, 2016

As you may know, there is a subset of Javascript that compiles efficiently to assembly used as backend of various compilers including a C compiler like emscripten. We’d like to present you in the same spirit how never to allocate in OCaml.

Before starting to write anything, we must know how to find if a code is allocating. The best way currently is to look at the Cmm intermediate representation. We can see it by calling `ocamlopt` with the `-dcmm` option:

`ocamlopt -c -dcmm test.ml`

let f…
Read more...

Ocsigen: step by step tutorial for client-server Web application (2/2) — Ocsigen blog (Ocsigen team), Mar 30, 2016

This is the end of the tutorial about writing a collaborative Web drawing in OCaml. Have a look at the full tutorial if you haven’t read the first part or if you want a version with full colors and links.

In the last part, we’ve seen how to create a client-server Web application in OCaml. The server generates a Web page and sends it together with an OCaml program (compiled to JavaScript) to the browser.

We will now see how to draw on the canvas, program mouse events with Lwt, and do server…

Read more...

Weekly News — OCaml Weekly News, Mar 29, 2016

  1. opam-builder bot and opam-file website
  2. Is it possible to get back some OCaml code after ppx processing ?
  3. gen_js_api 1.0, easy OCaml bindings for Javascript libraries
  4. Other OCaml News

forge.ocamlcore.org NOT reported as unsafe anymore — OCamlCore Forge News ( (Sylvain Le Gall), Mar 29, 2016

Thanks to the help of E. Török and the Google Webmaster Tools we were able to spot the problem and remove what appears to the search engines as a virus. We are now indexed again on Google and not reported anymore as containing malicious content. There was actually no malicious content and no archive has been tempered with. It seems that some AV scanners consider OCaml programs as viruses. This is unfortunate but not the first time I see this kind of problem. As a general guideline: 1. Try to…Read more...

forge.ocamlcore.org reported as unsafe in Firefox/Chrome — OCamlCore Forge News ( (Sylvain Le Gall), Mar 27, 2016

The website is actually reported as containing malicious links. I noticed that some spambots were uploading content as bug attachment and I need to track all that and clean the website. https://www.google.com/transparencyreport/safebrowsing/diagnostic/index.html?hl=en-US#url=http://forge.ocamlcore.org/frs/download.php/1258/ounit-2.0.0.tar.gz Sylvain Le Gall

REPLs — Shayne Fletcher, Mar 26, 2016

Reusable interactive REPL

I play around with little languages enough that I've found it useful to have a minimal language independent REPL for use as a library component. It is expressed as a single higher order function satisfying this signature:

val repl
(eval : α list -> β -> γ)
(pe : δ -> Lexing.lexbuf -> β)
(tok : δ)
(string_of_t : γ -> ε) : unit
The first argument eval is a function to evaluate expressions in the language, the secon…Read more...

Weekly News — OCaml Weekly News, Mar 22, 2016

  1. automatic differentiation
  2. opam-cross-windows
  3. Sundials/ML 2.6.2
  4. ocaml-ctypes 0.5.0, a library for calling C functions directly from OCaml
  5. Other OCaml News

Format All the Data Structures — Cedeela (simon), Mar 20, 2016

Last October, I moved in Nancy to start working as an engineer with Jasmin Blanchette on an exciting project called Nunchaku. Since my domain is formal logic, I spend a lot of time manipulating, transforming, and traversing ASTs (abstract syntax trees). My primary method for debugging is pretty-printing structures; in nunchaku, I even have a --print-all flag to print the AST after each transformation, since the tool is basically a bidirectional pipeline that composes transformations. I will cert…

Read more...

Unraveling of the tech hiring market — Jane Street (David Powers), Mar 17, 2016

Recruiting talented people has always been challenging.

In some years that meant competing with a hot new company that aggressively courted every fresh graduate with promises of stock options and IPO glory.  In other years there wasn’t a specific company so much as an entire rising industry looking for people (I’m looking at you cloud services, driverless cars, and peer-to-peer sharing).  Either way, we understood the yearly back and forth.  Our job was to explain to candidates how we sta…

Read more...

A Machine Made this Book: Ten Sketches of Computer Science — OCaml Book, Mar 17, 2016

How do we decide where to put ink on a page to draw letters and pictures? How can computers represent all the world's languages and writing systems? What exactly is a computer program, what and how does it calculate, and how can we build one? Can we compress information to make it easier to store and quicker to transmit? How do newspapers print photographs with grey tones using just black ink and white paper? How are paragraphs laid out automatically on a page and split across multiple pages?

In

Read more...

Weekly News — OCaml Weekly News, Mar 15, 2016

  1. Question about Lwt/Async
  2. Profiling ocaml with lwt
  3. Flambda manual chapter
  4. opam-cross-windows
  5. Software engineer position at Tweag I/O
  6. Other OCaml News

Ocsigen: step by step tutorial for client-server Web application (1/2) — Ocsigen blog (Vincent Balat), Mar 15, 2016

This post (and the following one) is a step by step tutorial about client-server Web applications in OCaml. You can find the full tutorial here. It introduces the basics of Web programming with OCaml: type-checking HTML, defining services, using lightweight threads, writing a client-server program …

We will write a collaborative drawing application. It is a client-server Web application displaying an area where users can draw using the mouse, and see what other users are drawing at the same t…

Read more...

Seven Implementations of Incremental — Jane Street (Yaron Minsky), Mar 10, 2016

We finally got a decent recording of one of my favorite talks. This one is about our Incremental library (which I wrote about here), and in particular about the story of how we got to the present, quite performant, implementation.

It's not clear from the talk, but the work on this library wasn't done by me: The initial version was implemented by Stephen Weeks and Milan Stanojevic, and most of the intermediate versions were implemented by Nick Chapman and Valentin Gatien-Baron.

The high quality …

Read more...

Software Engineer at Purple (Full-time) — Functional Jobs (FunctionalJobs.com), Mar 08, 2016

Purple is a well-funded startup of about 15 people, backed by an Uber co-founder, and revolutionizing the way people get gas.

We are looking for an experienced Software Engineer who can thrive in a startup environment to help us continue to build and test our backend web service and mobile app platform. You would work closely with our small engineering team in a relatively flat organizational structure. You should be confident taking ownership of your specific piece of the product while being …

Read more...

Weekly News — OCaml Weekly News, Mar 08, 2016

  1. Released: 4.03.0+beta1
  2. ppx_deriving_protobuf 2.3
  3. OCamlnet-4.1.1
  4. pxp-1.2.8, webdav-1.1.5, cache-1.1.2, netamqp-1.1.2, wdialog-2.1.6, wtimer-1.2.1
  5. xstrp4-1.8.2
  6. ocaml bindings for gles 3
  7. Test coverage of generated lexers/parsers
  8. Question about Lwt/Async
  9. findlib-1.6.2
  10. Hmap 0.8.0
  11. Other OCaml News

OCaml Diary, Part 4b — Rudenoise, Mar 03, 2016

A simple OCaml CLI application and how it compares to some alternatives.

View older blog posts.