:while is a short circuit criterion in for expressions. The elements of the list will be generated until the first time it performs a test with an error.
In your case
(for [<code omitted> :while (not (= 12 (+ abc)))] (list abc))
will stop generating elements as soon as it finds triplet summation up to 12.
One problem, however, it does not do what you expect. The triplet itself will not be part of the result, since it did not pass the test.
Understanding the list may not be the best solution if you are looking for only one match result. Why not just use a loop?
(loop [xs (for [a (range 1 100) b (range 1 100)] [a, b])] (when (seq xs) (let [[a, b] (first xs) c (Math/sqrt (+ (Math/pow (int a) 2) (Math/pow (int b) 2)))] (if (not (= 12 (+ abc))) (recur (next xs)) (list abc)))))
source share