Skip to content

Instantly share code, notes, and snippets.

View rleonid's full-sized avatar
🎯
What does it all mean?

Leonid Rozenberg rleonid

🎯
What does it all mean?
View GitHub Profile
@rleonid
rleonid / Classify_example.ml
Last active September 8, 2015 16:57
Oml classification example
# open Classify ;;
# let feature_map = function | `shortbread -> 0 | `lager -> 1 | `whiskey -> 2 | `porridge -> 3 | `football-> 4 ;;
val feature_map : [< `football | `lager | `porridge | `shortbread | `whiskey ] -> int = <fun>
# let data =
[
(`English, [`whiskey; `porridge; `football]);
(`English, [`shortbread; `whiskey; `porridge]);
(`English, [`shortbread; `lager; `football]);
(`English, [`shortbread; `lager]);
(`English, [`lager; `football]);
@rleonid
rleonid / Parametric Polymorphic Variants
Last active August 29, 2015 14:11
Playing around with typing parametric polymorphic vairants
type ('b , 'a) foo = [ `Foo of 'a
| `Bar of 'b
]
type ('a, 'c) ani = [ (('a, 'c) foo)
| `Cat of 'a
| `Dog of 'a
]
let foo_to_str = function