title: how to check if list is empty
body: <p>just started learning sml so excuse me for any discomfort that i may cause. </p>
  
  <p>Okay so here is my function:</p>
  
  <pre><code>fun swapPairsInList [(x,y)]
  swapPairsInList: (’x * ’y) list --&gt; (’y * ’x) list
  </code></pre>
  
  <p>I know how to swap the pairs in the list (recursively) but where i'm having issues is with the base case on when the list is empty (null). How exactly do i check if this list is null? I tried</p>
  
  <pre><code>null [(x,y)]
  </code></pre>
  
  <p>but that's just throwing back an exception. Should i be using pattern matching to solve this problem?</p>