Hackerrank: Breaking the records I'm learning Clojure and am a rank n00b at it, trying to learn from books and online tutorials (but I'm sometimes concerned that I am picking up bad habits or at least not all the good habits). For exercise I did the Breaking the Records problem on Hackerrank.
TL;DR problem description:
For a list of scores (in historic order), count the number of times the previous best score was exceeded as well as the previous worst score was undercut.
In an iterative language it is quite easy to just iterate through the list; but Clojure does not do iteration and I decided to tackle this problem for exercise in constructing a (tail end) recursive solution. To make it easier for myself, I first did a recursive solution in Java, which I then translated. All in all, it's quite a simple recursive function without rocket surgery involved.
Obviously my code works, as shown by the included unit tests. My concerns are however as follows:

When put next to the Java code, the two look fairly similar. Did I follow &quot;idiomatic&quot; Clojure programming, or is it just a clumsy &quot;word-for-word transliteration&quot;?
Are there any areas that could have been more compact and/or easier to understand by using different Clojure constructs?

Your critical input will be highly appreciated - including regarding the unit testing, as that is arguably an important part of programming, which I want to learn and practice in parallel.
Code:
(ns hackerrank.breaking-records
  (:require [clojure.test :refer :all]))

(defrecord Record [min max countworse countbetter])

(defn recalc-record [rec newscore]
  (Record.
    (min newscore (:min rec))
    (max newscore (:max rec))
    (+ (:countworse rec) (if (&gt; (:min rec) newscore) 1  0))
    (+ (:countbetter rec) (if (&lt; (:max rec) newscore) 1  0))))

(defn accumulate [curr-record remaining-scores]
  (if (nil? (second remaining-scores))
    curr-record
    (recur (recalc-record curr-record (second remaining-scores)) (rest remaining-scores)))
)

(defn breaking-records [scores]
  (let [result (accumulate (Record. (first scores) (first scores) 0 0) scores)]
    (list (:countbetter result) (:countworse result))))

(deftest test-records
  (testing &quot;edge cases&quot;
    (is (= '(0 0) (breaking-records '())) &quot;no games played yet&quot;)
    (is (= '(0 0) (breaking-records '(5))) &quot;single game&quot;))
  (testing &quot;hackerrank examples&quot;
    (is (= '(2 4) (breaking-records '(10 5 20 20 4 5 2 25 1))))
    (is (= '(4 0) (breaking-records '(3 4 21 36 10 28 35 5 24 42)))))
)
I re-wrote your solution to use more typical Clojure features.  When you are looping over data and need to keep track of accumulated state, it is hard to beat loop/recur.  A first example:
(ns tst.demo.core
  (:use clojure.test))

(defn breaking-records
  [scores]
  ; this loop has 5 variables. Init all of them
  (loop [low         (first scores)
         high        (first scores)
         nworse      0
         nbetter     0
         score-pairs (partition 2 1 scores)]
    (if (empty? score-pairs)
      {:nbetter nbetter :nworse nworse}
      (let [curr-score-pair (first score-pairs)
            new-score       (second curr-score-pair)]
        ; start the next iteration with modified versions of the 5 loop vars
        (recur
          (min new-score low)
          (max new-score high)
          (if (&lt; new-score low)
            (inc nworse)
            nworse)
          (if (&lt; high new-score)
            (inc nbetter)
            nbetter)
          (rest score-pairs))))))

and unit tests:
(deftest test-records
  (testing &quot;edge cases&quot;
    (is (= (breaking-records []) {:nbetter 0 :nworse 0}) &quot;no games played yet&quot;)
    (is (= (breaking-records [5]) {:nbetter 0 :nworse 0}) &quot;single game&quot;))
  (testing &quot;hackerrank examples&quot;
    (is (= (breaking-records [10 5 20 20 4 5 2 25 1]) {:nbetter 2 :nworse 4}))
    (is (= (breaking-records [3 4 21 36 10 28 35 5 24 42]) {:nbetter 4 :nworse 0}))))

; ***** NOTE: it's much easier to use vectors like [1 2 3] instead of a quoted list `(1 2 3)

Please see this list of documentation, esp. the Clojure CheatSheet. Also, the template project as a whole shows how I like to structure things.  :)
The function that helps the most is partition.  See the docs.

Slight refactoring
You can simplify it a small amount and make it a bit more compact by using more specialized functions like reduce and cond-&gt;.  This version uses a map to hold state and reduce to perform the looping:
(defn breaking-records
  [scores]
  (let [state-init     {:low     (first scores)
                        :high    (first scores)
                        :nworse  0
                        :nbetter 0}
        accum-stats-fn (fn [state score-pair]
                         ; Use map destructuring to pull out the 4 state variables
                         (let [{:keys [low high nworse nbetter]} state 
                               new-score (second score-pair)
                               state-new {:low     (min new-score low)
                                          :high    (max new-score high)
                                          :nworse  (cond-&gt; nworse
                                                     (&lt; new-score low) (inc))
                                          :nbetter (cond-&gt; nbetter
                                                     (&lt; high new-score) (inc))}]
                           state-new))
        state-final    (reduce accum-stats-fn
                         state-init
                         (partition 2 1 scores))
        result         (select-keys state-final [:nworse :nbetter])]
    result))