Cuihtlauac
cuihtlauac.bsky.social
Cuihtlauac
@cuihtlauac.bsky.social
Corecursive tinkerer, camler, globetrotter
February 4, 2025 at 4:13 PM
You stand in good company:

Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.

Donald Knuth, 1992
February 4, 2025 at 6:50 AM
I also like this one:
module String = struct include Stdlib.String module Map = Map.Make(Stdlib.String) end
February 3, 2025 at 7:08 PM
Quite an effort indeed, but with a high degree of parallelizability.
January 28, 2025 at 5:06 PM
That looks fine. I'm among those who don't use polymorphic variants unless there's a strong case for such as ocaml.org/docs/error-h...
January 23, 2025 at 3:24 PM
Indeed it does. It's >>= fun, which is the same as let*. Custom binder gives you a free (and hidden) eta.
January 23, 2025 at 11:26 AM
Yes, it is. But I find it particularly disturbing in that case. We hear >>= and let* are the same. Not in that respect.
January 23, 2025 at 11:02 AM
January 23, 2025 at 10:32 AM
let ( >>= ) = Lwt.bind
let ( let* ) = Lwt.bind

(* Prints hello after world *)
let _ = f "hello" () >>= f "world"

(* Prints world after hello *)
let _ = let* u = f "hello" () in f "world" u

Can you write f? What's going on?
#ocaml #lwt
January 23, 2025 at 6:36 AM
1: f L gives I. n is a T with holes labelled x or y. 2: chop Is gives H2 hole set. 3&4: chop 2s gives H3 and H4 hole sets. {x} = H2 ∩ H3, {y} = H2 ∩ H4. Something like that? Haven't written the code. Can you solve that as polynomial coefficients from points?
January 22, 2025 at 2:53 PM
#ocaml binding operator abuse

let ( let< ) ic f =
Fun.protect ~finally:(fun () -> In_channel.close ic) (fun () -> f ic)

let () =
let< ic = In_channel.open_text Sys.argv.(1) in
In_channel.input_lines ic
|> List.concat_map (String.split_on_char ' ')
|> List.iter print_string
January 15, 2025 at 10:12 AM
Isn't it Barron and Strachey product? That's far from trivial.
January 11, 2025 at 4:59 PM