title: Why does my Pradicate my_flatten/2 not flatten a nested list structure? (Prolog)
body: <p>The predicate i wrote flattens a simple list like List=[a,b,c,[d,e],f], 
  but not a list like List2 = [a,b,[[c,d],e],f]. Here is my code:</p>
  
  <pre><code>my_flatten([], []).
  my_flatten([H|T], R):- not(is_list(H)), my_flatten(T, R1), append([H], R1,  R).
  my_flatten([H|T], R):- is_list(H), my_flatten(T, R1), append(H, R1, R).
  </code></pre>
  
  <p>My idea is to check whether the head is a list or not and depending on this decision to go through recursion and append the tail to the head. </p>
  
  <p>Am I missing an important point? </p>