Bozhidar Batsov (a.k.a. Bug)
@batsov.net
1.8K followers
590 following
1.8K posts
Hacker. Emacs Zealot. Lover of parentheses. Firebrand. Bulgarian. Not necessarily in that order.
The artist formerly known as @bbatsov.
Personal blog: https://batsov.com
FOSS projects blog: https://metaredux.com
Emacs blog: https://emacsredux.com
Posts
Media
Videos
Starter Packs
Reposted by Bozhidar Batsov (a.k.a. Bug)
OCaml
@ocaml.org
· 5d
Release of OCaml 5.4.0
We have the pleasure of celebrating the birthdays of Camille Saint-Saëns and
Karl Schwarzschild by announcing the release of OCaml version 5.4.0.
Some of the highlights of OCaml 5.4.0 are:
Labelled tuples
It is now possible to put labels on tuple fields
let ( * ) (x,~dx) (y,~dx:dy) = x*.y, ~dx:(x *. dy +. y *. dx )
Those labeled tuples are equivalent to SML records: they are an order-dependent and structurally-typed variants of records. They are mostly intended for local types.
Array literal syntax support for immutable arrays and floatarrays
The array literal syntax is now shared by array-like primitive datatypes,
like 'a array, floatarray and immutable array iarray.
For instance, this code
let x =
let x = Array.Flotarray.create 3 in
Array.Flotarray.set x 0 1.;
Array.Flotarray.set x 1 2.;
Array.Flotarray.set x 2 3.;
x
can now be written
let x : floatarray = [|0.; 1.; 2.|]
This also supported in patterns
let one = match x with
| [|_;y;_|] -> Some y
| _ -> None
However array indexing still needs to go through user-defined indexing operator
let (.$()) = Array.Floatarray.get
let (.$()
dlvr.it
Reposted by Bozhidar Batsov (a.k.a. Bug)