Attn: Development Editor, Latest OCaml Weekly News
Alan Schmitt <[email protected]> Tue, 31 Dec 2024 09:03:48 +0100
| Newsgroups | gmane.comp.lang.caml.inria |
|---|---|
| Message-ID | <[email protected]> |
Hello
Here is the latest OCaml Weekly News, for the week of December 24 to 31,
2024.
Table of Contents
─────────────────
Using Property-Based Testing to Test OCaml 5
First release of elm_playground
First release of flatunionfind
Serving This Article from RAM with Dream for Fun and No Real Benefit
Other OCaml News
Old CWN
Using Property-Based Testing to Test OCaml 5
════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/blog-using-property-based-testing-to-test-ocaml-5/14550/2>
Jan Midtgaard announced
───────────────────────
I've written up part 2 on our effort to utilize property-based testing
to stress test the OCaml 5 run time system. Happy Christmas reading!
🎄🎅 🎁 😄
<https://tarides.com/blog/2024-12-23-multicore-property-based-tests-for-ocaml-5-challenges-and-lessons-learned/>
First release of elm_playground
═══════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-elm-playground/15838/1>
Yoann Padioleau announced
─────────────────────────
It is my pleasure to announce the first release of `elm_playground',
an OCaml package that allows you to easily create /pictures/,
/animations/, and even /video games/ in a portable way using an API
that really simplifies how to view the computer and its devices (the
screen, keyboard, and mouse). The library offers a native backend to
run the games from a terminal and a web backend to run the games in
your browser.
This is a port of the excellent Elm playground package
<https://github.com/evancz/elm-playground> to OCaml.
You can install it via OPAM via `opam install elm_playground'.
Here are a few examples of code using the library.
First a "picture" app:
┌────
│ (* from https://elm-lang.org/examples/picture *)
│ open Playground
│
│ let app =
│ picture [
│ rectangle brown 40. 200.
│ |> move_down 80.;
│ circle green 100.
│ |> move_up 100.;
│ ]
│
│ let main = Playground_platform.run_app app
└────
<https://global.discourse-cdn.com/flex020/uploads/ocaml/optimized/2X/7/76fc1990fe116911097764df986f64fed41c28a4_2_470x500.png>
Then an "animation" app:
┌────
│ (* from https://elm-lang.org/examples/animation *)
│ open Playground
│
│ let view time = [
│ octagon darkGray 36.
│ |> move_left 100.
│ |> rotate (spin 3. time);
│ octagon darkGray 36.
│ |> move_right 100.
│ |> rotate (spin 3. time);
│ rectangle red 300. 80.
│ |> move_up (wave 50. 54. 2. time)
│ |> rotate (zigzag (-. 2.) 2. 8. time);
│ ]
│
│ let app =
│ animation view
│
│ let main = Playground_platform.run_app app
└────
<https://global.discourse-cdn.com/flex020/uploads/ocaml/optimized/2X/e/e91563cbb6a0863570bbb19b057f5e8dae7164bf_2_470x500.png>
And finally a "game" app:
┌────
│ (* from https://elm-lang.org/examples/mouse *)
│ open Playground
│
│ let view _computer (x, y) = [
│ square blue 40.
│ |> move x y
│ ]
│
│ let update computer (x, y) =
│ (x +. to_x computer.keyboard, y +. to_y computer.keyboard)
│
│ let app =
│ game view update (0., 0.)
│
│ let main = Playground_platform.run_app app
└────
<https://global.discourse-cdn.com/flex020/uploads/ocaml/optimized/2X/2/24e8ffe672cda66c6a49e02013347cda0640f771_2_470x500.png>
Note that you can write more complex games. For example here is a
screenshot of a toy tetris app:
<https://global.discourse-cdn.com/flex020/uploads/ocaml/original/2X/4/4ded1d55c9994935c5ec3786ae549ba3a71b8eb6.png>
For more information, follow the README at
<https://github.com/aryx/ocaml-elm-playground>
And merry christmas!
First release of flatunionfind
══════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-flatunionfind/15847/1>
François Pottier announced
──────────────────────────
I am pleased to announce the first release of `flatunionfind', a small
library that offers a union-find data structure, stored inside a
vector.
This library is an alternative to my existing library `unionFind', and
could be faster or slower, depending on your use case.
┌────
│ opam update
│ opam install flatunionfind
└────
For more information, see the [documentation].
Happy unions and finds, FP.
[documentation]
<https://cambium.inria.fr/~fpottier/flatunionfind/doc/flatunionfind/>
Serving This Article from RAM with Dream for Fun and No Real Benefit
════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/serving-this-article-from-ram-with-dream-for-fun-and-no-real-benefit/15856/1>
Thomas Letan announced
──────────────────────
I’ve been playing with my website lately, more precisely on how the
contents is delivered to the readers. Before, it was merely a boring,
static website delivered by Nginx; now it’s a Dream-powered HTTP
server with all the pages in-memory.
[I’ve written about this fun, little project], and you may find the
article interesting. It covers several topis: fun experiments with the
Dream library, HTTP arcane one cannot ignore if they want to implement
a browser-friendly server, and even some Docker because why not!
Happy holidays everyone!
[I’ve written about this fun, little project]
<https://soap.coffee/~lthms/posts/DreamWebsite.html>
Other OCaml News
════════════════
From the ocaml.org blog
───────────────────────
Here are links from many OCaml blogs aggregated at [the ocaml.org
blog].
• [Serving This Article from RAM with Dream for Fun and No Real
Benefit]
• [Multicore Property-Based Tests for OCaml 5: Challenges and Lessons
Learned]
[the ocaml.org blog] <https://ocaml.org/blog/>
[Serving This Article from RAM with Dream for Fun and No Real Benefit]
<https://soap.coffee/~lthms/posts/DreamWebsite.html>
[Multicore Property-Based Tests for OCaml 5: Challenges and Lessons
Learned]
<https://tarides.com/blog/2024-12-23-multicore-property-based-tests-for-ocaml-5-challenges-and-lessons-learned>
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
to the [caml-list].
[Alan Schmitt]
[send me a message] <mailto:[email protected]>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[caml-list] <https://sympa.inria.fr/sympa/info/caml-list>
[Alan Schmitt] <https://alan.petitepomme.net/>