It was hard for me to say exactly what you wanted, so this is my understanding of what you are trying to do.
In my case, I wanted to find if there was no element in one report in the second report. The match returned nil, and the mismatch returned an actual element that did not match.
The following functions complete the comparison of the displayed value with the key.
Using something like find-first
, probably what you want to do.
(defn find-first "This is a helper function that uses filter, a comparision value, and stops comparing once the first match is found. The actual match is returned, and nil is returned if comparision value is not matched." [pred col] (first (filter pred col))) (defn str-cmp "Takes two strings and compares them. Returns 0 if a match; and nil if not." [str-1 str-2 cmp-start-pos substr-len] (let [computed-str-len (ret-lowest-str-len str-1 str-2 substr-len) rc-1 (subs str-1 cmp-start-pos computed-str-len) rc-2 (subs str-2 cmp-start-pos computed-str-len)] (if (= 0 (compare rc-1 rc-2)) 0 nil))) (defn cmp-one-val "Return nil if first key match found, else the original comparision row is returned. cmp-row is a single sequence of data from a map. i cmp-key is the key to extract the comparision value. cmp-seq-vals contain a sequence derived from one key in a sequence of maps. cmp-start and substr-len are start and stop comparision indicies for str-cmp." [cmp-row cmp-key cmp-seq-vals cmp-start substr-len] (if (find-first
source share