title: What is the `union` in OCaml, really
body: <p>I am learning the <code>union</code> bit of OCaml and I got quite confused.</p>
  
  <hr>
  
  <p>In C, a union is like this</p>
  
  <pre><code>union {
      int i;
      float f;
  } x;
  x.i = 0x27;
  printf ("%f\n", x.f);
  </code></pre>
  
  <p>So, <strong>does union in OCaml serve the same purpose?</strong></p>
  
  <p>Let's take an example. Below is a union definition:</p>
  
  <p><img src="https://i.stack.imgur.com/eJKCB.png" alt="enter image description here"></p>
  
  <p><strong>how do I use this union like the C example above?</strong></p>
  
  <hr>
  
  <p>Also for this one </p>
  
  <p><img src="https://i.stack.imgur.com/cJBwX.png" alt="enter image description here"></p>
  
  <p><strong>Is <code>type 'a set</code> a union definition? How about <code>type 'a set = 'a list</code>? and why?</strong></p>