<commit_before>(ns sort.merge)

(defn merge-sorted [xs ys]
  (reverse
    (loop [xs xs ys ys sorted '()]
      (cond
        (empty? xs) (concat (reverse ys) sorted)
        (empty? ys) (concat (reverse xs) sorted)
        :else (let [x (first xs) y (first ys)]
                (if (< x y)
                  (recur (drop 1 xs) ys (conj sorted x))
                  (recur (drop 1 ys) xs (conj sorted y))))))))

(defn merge-sort [xs]
  (let [n (count xs)]
    (if (< n 2)
      xs
      (let [split (quot n 2)]
        (merge-sorted
          (merge-sort (take split xs))
          (merge-sort (drop split xs)))))))
<commit_msg>use more idiomatic lisp functions<commit_after>(ns sort.merge)

(defn merge-sorted [xs ys]
  (reverse
    (loop [xs xs ys ys sorted '()]
      (cond
        (empty? xs) (concat (reverse ys) sorted)
        (empty? ys) (concat (reverse xs) sorted)
        :else (let [x (first xs) y (first ys)]
                (if (< x y)
                  (recur (rest xs) ys (cons x sorted))
                  (recur (rest ys) xs (cons y sorted))))))))

(defn merge-sort [xs]
  (let [n (count xs)]
    (if (< n 2)
      xs
      (let [split (quot n 2)]
        (merge-sorted
          (merge-sort (take split xs))
          (merge-sort (drop split xs)))))))

{'fraction_non_alphanumeric': 0.15275590551181104, 'fraction_numerical': 0.004724409448818898, 'mean_word_length': 1.8307349665924275, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '873729', 'n_tokens_mistral': 476, 'n_tokens_neox': 440, 'n_words': 158}