title: Non-decreasing list of lists in Scheme?
body: <p>We need a Scheme function called <code>nondecreaselist</code>, which takes in a list of numbers and outputs a list of lists, which overall has the same numbers in the same order, but grouped into lists that are non-decreasing.</p>
  
  <p>For example, if we have input <code>(1 2 3 4 1 2 3 4 1 1 1 2 1 1 0 4 3 2 1)</code>, the output should be:</p>
  
  <p><code>((1 2 3 4) (1 2 3 4) (1 1 1 2) (1 1) (0 4) (3) (2) (1))</code></p>
  
  <p>How would you implement this? I know we have to use recursion.
  My attempt so far:</p>
  
  <pre><code>(define (nondecreaselist s) 
    (cond ((null? s) '())
          ((cons (cons (car s)
                       ((if (and (not (null? (cadr s)))
                                 (not (&gt; (car s) (cadr s))))
                            ((cadr s))
                            ('()))))
                 (nondecreaselist (cdr s))))))
  </code></pre>
  
  <p>However, this gives me the error:</p>
  
  <blockquote>
    <p><em>(int) is not callable:</em></p>
  </blockquote>