Consider a sequence of $n$ numbers and imagine you need to compute the maximum of all adjacent sub-sequences of length $k$. How would you do that efficiently?
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).
LexiFi is currently experimenting with the js_of_ocaml compiler in order to create some browser-side applications in OCaml.
This post is about the special representation that OCaml uses for arrays of floating point values. My claim is that this special representation is useful, but also harmful in some contexts. There are better alternatives that achieve the same benefits without the drawbacks.
The release of OCaml 4.02 is approaching and amongst many other new stuff, it will include the work on -ppx and extension points, supporting light-weight syntactic tools (without Camlp4).
I'd like to introduce a new language feature, inlined record arguments on constructors, which I propose for inclusion in OCaml. In a nutshell, it allows you to define a record directly within a sum type constructor:
The “O” part of OCaml is not very popular amongst OCaml developers and many of them explain (with some pride) that they avoid any contact with the OO sublanguage altogether.
Being lazy is sometimes good, especially if you don't have to work too hard to be lazy.
In this post, I propose Static Exceptions as a new language feature allowing programmers to express interesting control flows in a compact way.
The goal is to display the following to stdout:
(0,0) (1,1) (2,2) … (1000000,1000000).
Most languages provide some way to manipulate tuples of values with a proper label for each field. They are called structures in C, records in OCaml; objects as found in most mainstream OO languages extend this same notion.
In a previous post, I've described a proposal on how to get rid of Camlp4 to write simple syntax extensions. This proposal slowly becomes a reality:
It is often useful to get access to types at runtime, in order to implement generic type-driven operations. A typical example is a generic value pretty-printer.
A little teaser for OCaml gurus: what does the function below do?
In OCaml, generic functions like comparison and hashing are quite useful but not very flexible. In this post, I'll explain some tricks that might be useful when you want to tweak the behavior of these generic functions for your own data structures.
Thanks to an ongoing work by Jacques Le Normand, there is some hope to see Generalized Algebraic Datatypes (GADTs) in OCaml soon, so it's time to get familiar with them! In this post, I'll show how to use this new feature to represent OCaml types at runtime and define generic type-driven operations.
This is a follow-up on yesterday's post about implicit values. With five more lines added to the branch, we know have implicit arguments as well.
In this post, I'll not describe an existing extension to OCaml that we use at LexiFi, but rather some ideas for a future possible extension.
OCaml is a very important language at LexiFi. We use it as our primary internal development language. We also expose it to some of our power users: they can write their own applications or extend LexiFi Apropos (our flagship product) with custom addins written in OCaml.