Pattern matching left of the = sign is helpful for tuple, records and destructuring variant types with a single constructors. # let (x,y) = (1,2);; > val x : int = 1 > val y : int = 2 > # type r = { x : int; y : int; };; > type r = { x : int; y : int; } > # let {x=a;y=b} = {x=1;y=2};; > val a : int = 1 > >> val b : int = 2 > > # let {x=a} = {x=1;y=2};; > > val a : int = 1 > # type point = Point of int * int;; > type point = Point of int * int > # let Point (x,_) = Point(1,2);; > val x : int = 1 > -- nL On Fri, Mar 18, 2016 at 2:04 PM, Mr. Herr wrote: > Hi, > > in a small presentation of OCaml (Linux User Group Bremen) I got some > interesting questions, and > trying to answer I noticed I took something for granted that was not fully > understood. > > Looking at this in the toplevel: > > # let () = () ;; > # () ;; > - : unit = () > # let _ = () ;; > - : unit = () > # let None = None;; > Warning 8: this pattern-matching is not exhaustive. > Here is an example of a value that is not matched: > Some _ > # > > ... the question is: okay, pattern matching left of the equal sign, but > what does it define? > It defines unit and None in the environment, and then that value is just > sitting there? > > /Str. >