Programming-Idioms

History of Idiom 43 > diff from v58 to v59

Edit summary for version 59 :
New Clojure implementation by user [daveliepmann]

Version 58

2020-03-31, 16:46:33

Version 59

2020-04-29, 13:57:31

Idiom #43 Break outer loop

Look for a negative value v in 2D integer matrix m. Print it and stop searching.

Illustration

Idiom #43 Break outer loop

Look for a negative value v in 2D integer matrix m. Print it and stop searching.

Illustration
Code
(loop [rows m]
  (if-let [v (some #(when (neg? %) %) (first rows))]
    v
    (recur (rest rows))))