caml-list - the Caml user's mailing list
 help / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: "lwn" <lwn@lwn.net>, "cwn"  <cwn@lists.idyll.org>, caml-list@inria.fr, comp@lists.orbitalfox.eu
Subject: [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
Date: Tue, 05 Jan 2021 12:22:05 +0100
Message-ID: <877dord3xe.fsf@m4x.org> (raw)

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

Hello

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
Old CWN


First release of Feat
═════════════════════

  Archive:
  <https://discuss.ocaml.org/t/ann-first-release-of-feat/7033/1>


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
  (2012).

  More details can be found here:

  <https://gitlab.inria.fr/fpottier/feat/>


OCluster and OBuilder
═════════════════════

  Archive:
  <https://discuss.ocaml.org/t/ann-ocluster-and-obuilder/7035/1>


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:0.0.0.0:9000 \
  │   --capnp-public-address=tcp:127.0.0.1:9000 \
  │   --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:

  <https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/d/d5ff5aaa0259d7b59445b156e6b642a421040b64_2_920x750.png>


[OCluster] <https://github.com/ocurrent/ocluster>

[opam-repo-ci] <https://github.com/ocurrent/opam-repo-ci>

[ocurrent/overview] <https://github.com/ocurrent/overview>

[README] <https://github.com/ocurrent/ocluster/blob/master/README.md>

[OBuilder] <https://github.com/ocurrent/obuilder>

[macos support] <https://github.com/ocurrent/obuilder/issues/57>


Plotting 3D vectors
═══════════════════

  Archive: <https://discuss.ocaml.org/t/plotting-3d-vectors/7038/1>


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
  vectors.

  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] <http://plplot.org/>

[Oplot] <https://github.com/sanette/oplot>

[GNUplot bindings] <https://github.com/c-cube/ocaml-gnuplot>


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:

  <https://ocaml.xyz/book/visualisation.html>

  <https://github.com/owlbarn/owl/wiki/Tutorial:-How-to-Plot-in-Owl%3F>

  <https://github.com/owlbarn/owl/wiki/Plot-Gallery>

  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:

  <https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/3D_Vector.svg/800px-3D_Vector.svg.png>

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

  Maybe there is a way to use one of the 3D functions (`Plot.surf',
  `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.


[plline3]
<http://plplot.org/docbook-manual/plplot-html-5.15.0/plline3.html>


sanette also replied
────────────────────

  in oplot, there is the Curve3d object that should do it,
  <https://sanette.github.io/oplot/oplot/Oplot/Plt/index.html#type-plot_object.Curve3d>
  although it is quite rudimentary


Marshal determinism and stability
═════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/marshal-determinism-and-stability/7041/25>


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]
<https://gitlab.com/nomadic-labs/data-encoding>


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

  Archive:
  <https://discuss.ocaml.org/t/it-there-a-tutorial-for-js-of-ocaml-with-simple-graphics/4636/7>


Deep in this thread, Phat Ky said
─────────────────────────────────

  This is a really, really late reply but this youtube video was very
  helpful to me …  <https://www.youtube.com/watch?v=h_e5pPKI0K4>


Interesting OCaml exercises from François Pottier available online
══════════════════════════════════════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/interesting-ocaml-exercises-from-francois-pottier-available-online/7050/1>


gasche announced
────────────────

  The recent URL
  <https://ocaml-sf.org/learn-ocaml-public/#activity%3Dexercises>
  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]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/alpha_beta%26tab%3Dtext%26prelude%3Dshown>

[Parser combinators]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/parser_combinators%26tab%3Dtext>

[Huffman Compression]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/huffman%26tab%3Dtext%26prelude%3Dshown>

[Implementing backtracking with continuations]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/nondet_monad_cont%26tab%3Dtext%26prelude%3Dshown>

[reimplementing the core of a pretty-printer]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/pprint%26tab%3Dtext%26prelude%3Dshown>

[LearnOCaml] <https://github.com/ocaml-sf/learn-ocaml>

[OCaml Software Foundation] <http://ocaml-sf.org/>


Old CWN
═══════

  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
  archives].

  If you also wish to receive it every week by mail, you may subscribe
  [online].

  [Alan Schmitt]


[send me a message] <mailto:alan.schmitt@polytechnique.org>

[the archive] <http://alan.petitepomme.net/cwn/>

[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>

[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>

[Alan Schmitt] <http://alan.petitepomme.net/>


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

         reply index

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

Reply instructions:

You may reply publically 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=877dord3xe.fsf@m4x.org \
    --to=alan.schmitt@polytechnique.org \
    --cc=caml-list@inria.fr \
    --cc=comp@lists.orbitalfox.eu \
    --cc=cwn@lists.idyll.org \
    --cc=lwn@lwn.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox