title: Pattern Matching - Prolog vs. Haskell
body: <p>This is not a homework question, rather an exam study guide question. What is the difference between pattern matching in Prolog Vs Haskell?</p>
  
  <p>I've done some research and reading up on the theories behind them doesn't really give me a solid understanding between the two. I read that in Prolog, pattern matching is different because it has the ability to unify variables and thus be able to deduce through resolution and spit out the possible answer</p>
  
  <pre><code>eg ?- [a,b] = [a,X]
     X = b
  </code></pre>
  
  <p>Now I'm not sure how to display pattern matching in Haskell. I know that the same query above shown in Prolog will not work in Haskell because Haskell cannot unify like Prolog. I remember somewhere that to get the same answer in Haskell, you have to explicitly tell it through guards.</p>
  
  <p>I know that I am pretty close to understanding it, but I need someone to break it down Barney style for me so I can FULLY understand it and explain it to a 12 year old. This has been bugging me for quite some time and I can't seem to find a solid explanation.</p>
  
  <p>By the way the example shown above was just to display to you guys what I've learned so far and that I'm actually trying to find an answer. My main question does not relate to the examples above but rather a complete understanding on the difference between the two.</p>