title: How to write a function that counts increases in a list?
body: <p>The task I'm given is, in Racket, to &quot;write a function, countIncreases, which takes a list of numbers and returns how many times the consecutive numbers increase in value. For example, countIncreases '(1 3 2 4 5 1) should return 3 because there are three increases: 1 3, 2 4, 4 5.&quot;</p>
  <p>I've written a recursive function with the base case being if the list is empty, return 0. I believe my problem is properly comparing one value to the next. Should I be using a standard library list iteration function like foldr or map to accomplish this?</p>
  <p>My code and tests are below, and a screenshot of error messages is attached <a href="https://i.stack.imgur.com/oOfTC.jpg" rel="nofollow noreferrer">here</a></p>
  <pre><code>(define (countIncreases aList)
    (if (empty? aList)
         0
         (if (&lt; (first aList) (rest aList))
             (+ 1 (countIncreases (rest aList)))
             (countIncreases (rest aList)))))
  
  (check-expect (countIncreases '(1 3 2 4 5 1)) 3)
  (check-expect (countIncreases '()) 0)
  (check-expect (countIncreases '(1 2 3 4 5)) 4)
  (check-expect (countIncreases '(5 4 3 2 1 2)) 1)
  </code></pre>