Coggle requires JavaScript to display documents.
let
let rec
type
mutable
fun
function
exception
val
;;
;
int
char
string
bool=false|true
unit=()
float
exn
tuple
array
[|1;2|]
arr.(0)
arr.(0)<-3
'a list = [] | :: of 'a * 'a list
'a option = None | Some of 'a
type variable
polymophic
'a
record
{x=1;y=2}
r.x
r.x<-3
variant
Int of int
ref
!
:=
if...then...else...
match...with...
try...with...
for i = 0 to 1 do...done
while true do...done
label
fun ~x -> x
fun ~x:x1 -> x1
optional
fun ?x -> match x with | None -> 0 | Some y -> y
fun ?(x=1) -> x
polymophic variant
module ModName = struct ... end
ModName.field
module type ORDER_TYPE = sig ... end
module Set = functor (Elt:ORDER_TYPE) -> struct ... end
module StringSet = Set(OrderString)
module type SETFUNCTOR = functor (Elt:ORDER_TYPE) -> sig ... end
sig
mli
cmi
struct
ml
cmo
class point = object val mutable x = 0 method get_x = x end
class point x_init = object ... end
class point = fun x_init -> object ... end
let p = new point 7;; p#get_x
let p = object ... end
class point = let ... in object ... initializer ... end
let ...
initializer ...
class point = object (self) ... end
class virtual abstract_point_m = object method virtual get_x : int end
class virtual abstract_point_v = object inherit abstract_point_m val mutable virtual x : int end
class point = object inherit abstract_point_v val mutable x = 1 method get_x = x end
method private fff x = ...
method private virtual fff x = ...
class type point_interface = object ... end
class colored_point = object inherit point as super ... end
class ['a] oref x = object ... end
class intlist (l:int list) = object method fold : 'a. ('a -> int -> 'a) -> 'a -> 'a = ... end
let colored_point_to_point cp = (cp : colored_point :> point)
class functional_point y = object val x = y method move d = {< x = x + d >} end
let p = new point 7;; let q = Oo.copy p
class virtual comparable = object (_ : 'a) method virtual leq : 'a -> bool end