Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,11 @@
let bin_of_int d =
let last_digit n = [|"0"; "1"|].(n land 1) in
let rec aux lst = function
| 0 -> lst
| n -> aux (last_digit n :: lst) (n lsr 1)
in
String.concat "" (aux [last_digit d] (d lsr 1))
(* test *)
let () = [0; 1; 2; 5; 50; 9000; -5]
|> List.map bin_of_int |> String.concat ", " |> print_endline