Skip to content

Instantly share code, notes, and snippets.

View linoscope's full-sized avatar

Lin Oshitani linoscope

View GitHub Profile
$ dune build --verbose
cd _build/default/bin/web
# Just calls js_of_ocaml against `bench.bc`. Note that "--opt 3" is NOT passed.
js_of_ocaml -o bench.bc.js /home/lin/.opam/4.13.1/lib/bigstringaf/runtime.js bench.bc
$ dune build --profile release --verbose
cd _build/default/bin/web
@linoscope
linoscope / solve.ml
Created January 11, 2021 12:47
Sauran's Army (POJ 3069) in OCaml
open Core
open Stdio
let rec solve (r: int) (xs: int list): int =
match xs with
[] -> 0
| left_most::rest ->
rest
|> List.split_while ~f:(fun x -> x - left_most <= r)
|> (fun (left, right) ->
@linoscope
linoscope / solve.ml
Created January 11, 2021 11:13
Best Cow Line (POJ 3617) from Ant book
open Core
open Stdio
let rec solve s =
let rev_s = List.rev s in
match s, rev_s with
| ([], _) -> []
| (_, []) -> []
| h::t, rev_h::rev_t ->
if Poly.(s <= rev_s) then