Given the following function which takes two parameters (csv-data1 and csv-data2, vectors of vectors with only two lines and a guaranteed mismatch so will get cmp-val in my output).
(defn test-key-inclusion
"Accepts csv-data param and an index, a second csv-data param and an index,
and searches the second csv-data instances' rows (at index) to see if
the first file's data is located in the second csv-data instance."
[csv-data1 pkey-idx1 csv-data2 pkey-idx2 lnam-idx fnam-idx]
(reduce
(fn [out-log csv-row1]
(let [cmp-val (nth csv-row1 pkey-idx1 nil)
lnam (nth csv-row1 lnam-idx nil)
fnam (nth csv-row1 fnam-idx)
temp-rc (first (key-pres? cmp-val pkey-idx2 csv-data2))]
(if-not (nil? cmp-val)
(concat out-log (sorted-map cmp-val (vector lnam fnam))))))
{}
csv-data1))
With this conditional in the function,
(if-not (nil? cmp-val)
(concat out-log (sorted-map cmp-val (vector lnam fnam))))))
reduce returns nil.
Why is that?
Because if cmp-val is nil then you return nil from your reduce function.
Conditional should be
Note that
if-not (nil? foo)is equivalent toif foo