caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alan Schmitt <>
To: "lwn" <>, "cwn"  <>,,
Subject: [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
Date: Tue, 05 Jan 2021 12:22:05 +0100	[thread overview]
Message-ID: <> (raw)

[-- Attachment #1: Type: text/plain, Size: 14635 bytes --]


Here is the latest OCaml Weekly News, for the week of December 29, 2020
to January 05, 2021.

Table of Contents

First release of Feat
OCluster and OBuilder
Plotting 3D vectors
Marshal determinism and stability
It there a tutorial for `js_of_ocaml' with simple graphics?
Interesting OCaml exercises from François Pottier available online

First release of Feat


François Pottier announced

  A brief note to announce the first release of Feat:

  │ opam update
  │ opam install feat

  Feat is a library that offers support for counting, enumerating, and
  sampling objects of a certain kind, such as (say) the inhabitants of
  an algebraic data type.

  Feat was inspired by the paper "Feat: Functional Enumeration of
  Algebraic Types" by Jonas Duregård, Patrik Jansson and Meng Wang

  More details can be found here:


OCluster and OBuilder


Thomas Leonard announced

  I'm pleased to announce the first release of [OCluster]. A user can
  submit a build job (either a Dockerfile or an OBuilder spec) to the
  scheduler, which then runs the build on a worker machine, streaming
  the logs back to the client.

  This is the build scheduler / cluster manager that we use for e.g.
  [opam-repo-ci] (which you may have seen in action if you submitted a
  package to opam-repository recently).

  See [ocurrent/overview] for a quick overview of the various other CI
  services using it too.

  To install and run the scheduler use e.g.

  │ opam depext -i ocluster
  │ mkdir capnp-secrets
  │ ocluster-scheduler \
  │   --capnp-secret-key-file=./capnp-secrets/key.pem \
  │   --capnp-listen-address=tcp: \
  │   --capnp-public-address=tcp: \
  │   --state-dir=/var/lib/ocluster-scheduler \
  │   --pools=linux-arm32,linux-x86_64

  It will generate `key.pem' on the first run, as well as various
  capability files granting access for workers and clients. You then
  copy each generated pool capability (e.g. `pool-linux-x86_64.cap') to
  each machine you want in that pool, and run `ocluster-worker
  pool-linux-x86_64.cap' to start the worker agent. See the [README] for
  full details.

  [OBuilder] is an alternative to `docker build'. The main differences
  are that it takes a spec in S-expression format, which is easier to
  generate than a Dockerfile, handles concurrent builds reliably, and
  keeps copies of the logs so that you still see the output even if
  someone else performed the same build step earlier and the result is
  therefore taken from the cache.

  It currently supports ZFS and Btrfs for storage (it needs cheap
  snapshots) and `runc' for sandboxing builds. [macos support] is under
  development, but not yet upstreamed. It should be fairly easy to add
  support for any platform that has some form of secure chroot.

  OCluster supports monitoring with Prometheus, so you can see what the
  cluster is doing:


[OCluster] <>

[opam-repo-ci] <>

[ocurrent/overview] <>


[OBuilder] <>

[macos support] <>

Plotting 3D vectors

  Archive: <>

Andreas Poisel asked

  I'm doing linear algebra with Owl.  Owl-plplot works great for
  visualizing 2D vectors, but it doesn't seem to capable of plotting 3D

  I took a (fast) look at vanilla [Plplot], [Oplot], and the [GNUplot
  bindings], but I didn't find a simple way to plot 3D vectors.

  I don't need high quality plots, 3D surfaces, a lot of control or
  fancy features, just a coordinate system and some function to draw
  geometric primitives (points, lines, circles, etc.).

  Did I miss anything or do I have to build this myself with the good
  old Graphics module?

[Plplot] <>

[Oplot] <>

[GNUplot bindings] <>

Marshall Abrams replied

  What kind of vector representation do you want?  Just lines/arrows in
  3D?  That's just a curve in 3D, so it should be possible with Owl and
  plplot, at least.  Looks like it should be easy with oplot, too (but I
  haven't used oplot).  There are some 3D Owl plplot examples, with
  source code, on these pages:




  I don't know whether it will be easy to adapt them to your needs.  I
  wrote the last example on the last page above.  It's a plot of a
  series 2D curves in 3D.  Maybe some of the techniques can be adapted
  to your needs.  (The code is a few years old.  I'm not sure whether it
  works with the current version of Owl.)

  (If you end up having to use low-level bindings to plplot, oplot,
  etc. from Owl, you might consider contributing a wrapper module that
  makes it easy to do the kind of plot you want.)

Andreas Poisel then said

  Thank you for your answer.

  I'd just like to draw 3D vectors in a cartesian coordinate system.  A
  plot should look similar to this:


  I wouldn't even need arrows, simple lines would be ok.

  Maybe there is a way to use one of the 3D functions (`',
  `Plot.mesh', `Plot.contour'), but I can't figure it out.

Hezekiah Carty replied

  It's been a while since I worked with plplot but what you showed
  should be possible. The [plline3] function allows you to plot line
  segments in 3d space. The function is setup to take multiple segments
  in a single call. For a single segment each array would hold a single
  value. Colors can be set between draw calls.


sanette also replied

  in oplot, there is the Curve3d object that should do it,
  although it is quite rudimentary

Marshal determinism and stability


Deep in this thread, Bikal Lem mentioned and Raphaël Proust described

        [Binary module of data-encoding]

  Quick notes about this approach:

  • It is used extensively in the Tezos codebase. For data exchange (in
    the p2p layer), for data at rest (configuration files), and for a
    mix of the two (serialisation of economic protocol data which is
    both exchanged by peers and stored on disk).
  • It is flexible in that you have great control over the
    representation of data and the serialisation/deserialisation
    procedure. There is a medium-term plan to allow even more
    control. For now you can decide, say, if 8 booleans are represented
    as one byte, 8 bytes, or 8 words (or something else altogether) (see
    code below).
  • Some of the responsibility for correctness rests upon your shoulders
    as a user. E.g., when you encode a tuple, the left element must have
    either a fixed length (e.g., be an int8, int32, etc., be a
    fixed-length string, or be a tuple of fixed-length values) or be
    prefixed by a length marker (which the library provides a combinator
    for). Most of the errors for this are raised when you declare the
    encoding and a few are raised when you use the encoding. I recommend
    writing some tests to check that your encodings accept the range of
    values that you are going to throw at them.
  • The library is well tested: there are tests using crowbar to check
    that encoding and decoding are actual inverse of each others.

  Let me know if you have more questions. And in the meantime, here's
  two different encodings for a tuple of 8 booleans:

  │ (* easy-encoding, produces 8 bytes *)
  │ let boolsas8bytes =
  │    tup8 bool bool bool bool bool bool bool bool
  │ (* very-compact encoding, produces 1 byte *)
  │ let boolsas1byte =
  │    conv
  │       (fun (b1, b2, b3, b4, b5, b6, b7, b8) ->
  │ 	 let acc = 0 in
  │ 	 let acc = if b1 then acc lor 0b10000000 else acc in
  │ 	 let acc = if b2 then acc lor 0b01000000 else acc in
  │ 	 let acc = if b3 then acc lor 0b00100000 else acc in
  │ 	 …
  │ 	 acc)
  │       (fun i ->
  │ 	 let b1 = i land 0b10000000 <> 0 in
  │ 	 let b1 = i land 0b01000000 <> 0 in
  │ 	 let b1 = i land 0b00100000 <> 0 in
  │ 	 …
  │ 	 (b1, b2, b3, b4, b5, b6, b7, b8))
  │       uint8

  In general, data-encoding is probably slower than marshal, but its
  strong points are:
  • it offers some type guarantees,
  • it gives you some control over the representation of the data,
  • it allows you to define representations that are easy to parse in
    other languages or in other versions of the same language,
  • it generates documentation about the data-representation.

[Binary module of data-encoding]

It there a tutorial for `js_of_ocaml' with simple graphics?


Deep in this thread, Phat Ky said

  This is a really, really late reply but this youtube video was very
  helpful to me …  <>

Interesting OCaml exercises from François Pottier available online


gasche announced

  The recent URL
  contains auto-graded OCaml exercises, in particular a bunch of
  advanced and fairly interesting exercices written by François Pottier,
  which I would recommend for anyone knowledgeable in OCaml and curious
  about algorithms and functional programming. (You have to scroll down
  to see those, the exercises at the top come from the OCaml MOOC.)

  See for example François' exercises on:
  • [Alpha-Beta Search],
  • [Parser combinators],
  • [Huffman Compression],
  • [Implementing backtracking with continuations], or
  • my personal favorite, [reimplementing the core of a pretty-printer].

  Context: the exercise platform is [LearnOCaml], initially written by
  OCamlPro for the OCaml MOOC and maintaing by Yann Régis-Gianas
  (@yurug) on behalf of the [OCaml Software Foundation]. We (at the
  Foundation) are trying to assemble a corpus of nice OCaml exercises
  for teachers and people self-studying, and the nice exercises by
  François Pottier (@fpottier) were written as part of this initiative.

[Alpha-Beta Search]

[Parser combinators]

[Huffman Compression]

[Implementing backtracking with continuations]

[reimplementing the core of a pretty-printer]

[LearnOCaml] <>

[OCaml Software Foundation] <>


  If you happen to miss a CWN, you can [send me a message] and I'll mail
  it to you, or go take a look at [the archive] or the [RSS feed of the

  If you also wish to receive it every week by mail, you may subscribe

  [Alan Schmitt]

[send me a message] <>

[the archive] <>

[RSS feed of the archives] <>

[online] <>

[Alan Schmitt] <>

[-- Attachment #2: Type: text/html, Size: 29747 bytes --]

             reply	other threads:[~2021-01-05 11:22 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 11:22 Alan Schmitt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-26 17:54 Alan Schmitt
2022-07-19  8:58 Alan Schmitt
2022-07-12  7:59 Alan Schmitt
2022-07-05  7:42 Alan Schmitt
2022-06-28  7:37 Alan Schmitt
2022-06-21  8:06 Alan Schmitt
2022-06-14  9:29 Alan Schmitt
2022-06-07 10:15 Alan Schmitt
2022-05-31 12:29 Alan Schmitt
2022-05-24  8:04 Alan Schmitt
2022-05-17  7:12 Alan Schmitt
2022-05-10 12:30 Alan Schmitt
2022-05-03  9:11 Alan Schmitt
2022-04-26  6:44 Alan Schmitt
2022-04-19  5:34 Alan Schmitt
2022-04-12  8:10 Alan Schmitt
2022-04-05 11:50 Alan Schmitt
2022-03-29  7:42 Alan Schmitt
2022-03-22 13:01 Alan Schmitt
2022-03-15  9:59 Alan Schmitt
2022-03-01 13:54 Alan Schmitt
2022-02-22 12:43 Alan Schmitt
2022-02-08 13:16 Alan Schmitt
2022-02-01 13:00 Alan Schmitt
2022-01-25 12:44 Alan Schmitt
2022-01-11  8:20 Alan Schmitt
2022-01-04  7:56 Alan Schmitt
2021-12-28  8:59 Alan Schmitt
2021-12-21  9:11 Alan Schmitt
2021-12-14 11:02 Alan Schmitt
2021-11-30 10:51 Alan Schmitt
2021-11-16  8:41 Alan Schmitt
2021-11-09 10:08 Alan Schmitt
2021-11-02  8:50 Alan Schmitt
2021-10-19  8:23 Alan Schmitt
2021-09-28  6:37 Alan Schmitt
2021-09-21  9:09 Alan Schmitt
2021-09-07 13:23 Alan Schmitt
2021-08-24 13:44 Alan Schmitt
2021-08-17  6:24 Alan Schmitt
2021-08-10 16:47 Alan Schmitt
2021-07-27  8:54 Alan Schmitt
2021-07-20 12:58 Alan Schmitt
2021-07-06 12:33 Alan Schmitt
2021-06-29 12:24 Alan Schmitt
2021-06-22  9:04 Alan Schmitt
2021-06-01  9:23 Alan Schmitt
2021-05-25  7:30 Alan Schmitt
2021-05-11 14:47 Alan Schmitt
2021-05-04  8:57 Alan Schmitt
2021-04-27 14:26 Alan Schmitt
2021-04-20  9:07 Alan Schmitt
2021-04-06  9:42 Alan Schmitt
2021-03-30 14:55 Alan Schmitt
2021-03-23  9:05 Alan Schmitt
2021-03-16 10:31 Alan Schmitt
2021-03-09 10:58 Alan Schmitt
2021-02-23  9:51 Alan Schmitt
2021-02-16 13:53 Alan Schmitt
2021-02-02 13:56 Alan Schmitt
2021-01-26 13:25 Alan Schmitt
2021-01-19 14:28 Alan Schmitt
2021-01-12  9:47 Alan Schmitt
2020-12-29  9:59 Alan Schmitt
2020-12-22  8:48 Alan Schmitt
2020-12-15  9:51 Alan Schmitt
2020-12-01  8:54 Alan Schmitt
2020-11-03 15:15 Alan Schmitt
2020-10-27  8:43 Alan Schmitt
2020-10-20  8:15 Alan Schmitt
2020-10-06  7:22 Alan Schmitt
2020-09-29  7:02 Alan Schmitt
2020-09-22  7:27 Alan Schmitt
2020-09-08 13:11 Alan Schmitt
2020-09-01  7:55 Alan Schmitt
2020-08-18  7:25 Alan Schmitt
2020-07-28 16:57 Alan Schmitt
2020-07-21 14:42 Alan Schmitt
2020-07-14  9:54 Alan Schmitt
2020-07-07 10:04 Alan Schmitt
2020-06-30  7:00 Alan Schmitt
2020-06-16  8:36 Alan Schmitt
2020-06-09  8:28 Alan Schmitt
2020-05-19  9:52 Alan Schmitt
2020-05-12  7:45 Alan Schmitt
2020-05-05  7:45 Alan Schmitt
2020-04-28 12:44 Alan Schmitt
2020-04-21  8:58 Alan Schmitt
2020-04-14  7:28 Alan Schmitt
2020-04-07  7:51 Alan Schmitt
2020-03-31  9:54 Alan Schmitt
2020-03-24  9:31 Alan Schmitt
2020-03-17 11:04 Alan Schmitt
2020-03-10 14:28 Alan Schmitt
2020-03-03  8:00 Alan Schmitt
2020-02-25  8:51 Alan Schmitt
2020-02-18  8:18 Alan Schmitt
2020-02-04  8:47 Alan Schmitt
2020-01-28 10:53 Alan Schmitt
2020-01-21 14:08 Alan Schmitt
2020-01-14 14:16 Alan Schmitt
2020-01-07 13:43 Alan Schmitt
2019-12-31  9:18 Alan Schmitt
2019-12-17  8:52 Alan Schmitt
2019-12-10  8:21 Alan Schmitt
2019-12-03 15:42 Alan Schmitt
2019-11-26  8:33 Alan Schmitt
2019-11-12 13:21 Alan Schmitt
2019-11-05  6:55 Alan Schmitt
2019-10-15  7:28 Alan Schmitt
2019-09-03  7:35 Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).