title: How can I overload functions with pattern matching in Swift?
body: <p>In other high level languages you can use pattern matching for function overloading, such as in Mathematica. For example, you can write elegant code without if statements, here's an example of what I mean: </p>
  
  <p>sing Fibonacci:</p>
  
  <pre><code>fib[0|1] := 1
  fib[n_Integer?Positive] := fib[n - 1] + fib[n - 2]
  fib[n__] := fib /@ {n}
  fib[n_] := "undefined"
  </code></pre>
  
  <p>Here's:</p>
  
  <pre><code>In[]:= fib[10]
  Out[]= 89
  
  In[]:= {fib[-2], fib["2"]}    
  Out[]= {"undefined", "undefined"}
  
  In[]:= fib[1, 2, 3, 4, 5, 6, 7]
  Out[]= {1, 2, 3, 5, 8, 13, 21}
  </code></pre>
  
  <p>Does swift have functionality of this sort for pattern based arguments or something like it? </p>