title: Switch on argument type
body: <p>Using Open SCAD, I have a module that, like <code>cube()</code>, has a <code>size</code> parameter that can be a single value or a vector of three values.  Ultimately, I want a vector of three values.</p>
  
  <p>If the caller passes a single value, I'd like all three values of the vector to be the same.  I don't see anything in the language documentation about detecting the type of an argument.  So I came up with this hack:</p>
  
  <pre><code>module my_cubelike_thing(size=1) {
    dimensions = concat(size, size, size);
    width  = dimensions[0];
    length = dimensions[1];
    height = dimensions[2];
    // ... use width, length, and height ...
  }
  </code></pre>
  
  <p>When <code>size</code> is a single value, the result of the <code>concat</code> is exactly what I want: three copies of the value.</p>
  
  <p>When <code>size</code> is a three-value vector, the result of the <code>concat</code> is nine-value vector, and my code just ignores the last six values.</p>
  
  <p>It works but only because what I want in the single value case is to replicate the value.  Is there a general way to switch on the argument type and do different things depending on that type?</p>