title: Haskell sublists
body: <p>I have to make a function that finds specific sublists.</p>
  
  <pre><code>function :: Integer -&gt; Integer -&gt; [[Integer]]
  function n m = …
  </code></pre>
  
  <ul>
  <li>If <code>m</code> is smaller then <code>n</code> the program exits.</li>
  <li>If the <code>(mod (sum [1..n]) m) /= 0</code> then again error.</li>
  <li>Otherwise the program should find sublists.</li>
  <li>And the primary list is generated from <code>[1..n]</code> </li>
  </ul>
  
  <p>For example, if the numbers are <code>n = 6</code> and <code>m = 7</code>. List is <code>[1,2,3,4,5,6]</code> The answer is <code>[[6,1],[5,2],[4,3]]</code>.</p>
  
  <pre><code>function 6 7
  &gt;&gt;&gt; [[6,1],[5,2],[4,3]]
  </code></pre>
  
  <p>Order is not necessary. So on I have made these steps. Any help would be useful.Also example codes would be useful. If anyone can solve this problem, I would appreciate it. Code with solution would be very useful for me.</p>
  
  <pre><code>    function :: Integer -&gt; Integer -&gt; [[Integer]]
      function n m 
        |m &lt; n = error "m is smaller than n"
        |(mod (sum [1..n]) m) /= 0 = error "list sum doesn't devide with m"
        |otherwise = …
  </code></pre>