title: SML: Remove the entry from the List
body: <p>How can I delete the element <code>elem</code> in list <code>L</code>? If the list does not contain elem, then the function should return the list unchanged. </p>
  
  <p>For instance:</p>
  
  <pre><code>L = [1, 3, 4, 0, 5, 7]    
  elem = 5
  </code></pre>
  
  <p>So far I have the following function:</p>
  
  <pre><code>fun removeElem elem myList[] = myList
    | removeElem (myList::tl) = if mem myList elem then
                                  rm elem myList[]
                                else
                                  removeElem elem tl
  </code></pre>