Srt.msort [1;3;2;4;5;3];; Srt.merge [1;2;5;5] [1;3;4;6];; Srt.merge [1;2;5;5;2] [1;3;4;6];; let fib_dp n = let rec fib t n = if Lookup.mem t n then t else if n < 2 then Lookup.add t n 1 else let t = fib t (n-1) in let t = fib t (n-2) in let r = Lookup.find t (n-1) + Lookup.find t (n-2) in let t = Lookup.add t n r in t in Lookup.find (fib Lookup.empty n) n ;; Fib.fib 10;; fib_dp 10;; Fib.fib 30;; Fib.fib 35;; fib_dp 35;; Fib.fib 100;; fib_dp 100;; Beans.beans 150 75;; Beans.beans 5 5;; Beans.beans_dp 5 5;; Beans.beans_dp 150 75;; let rec beans t b w = if L.mem t (b,w) then t else if b = 1 && w = 0 then L.add t (b,w) (true,false) else if b = 0 && w = 1 then L.add t (b,w) (false,true) else if b < 0 || w < 0 then L.add t (b,w) (false, false) else let t = beans t (b-2) (w+1) in let t = beans t (b+1) (w-2) in let t = beans t (b-1) w in let r = L.find t (b-2,w+1) <||> L.find t (b+1,w-2) <||> L.find t (b-1,w) in L.add t (b,w) r ;; let t = Lookup.empty;; beans t 150 75;; Lookup.size t;; let t = beans t 150 75;; Lookup.size t;; let t = beans t 1500 750;; PCP.pcp1;; PCP.pcp3;; PCP.PCPParser.parse "[00;01;10] [110;011;10]";;