DEV Community

Discussion on: Daily Challenge #76 - Bingo! (or not...)

Collapse
 
not_jffrydsr profile image
@nobody • Edited

good ol' Clojure 😏

(ns dailyChallenge.seventySix)

(defn- bingo! [board]
 "don't do a thang if it ain't got that swang. ¯\_(ツ)_/¯"
 (let [BINGO #{2 9 14 7 15}
       reduc_board (set board) 
       contains-all? #(and (doseq [p %1] 
                       (contains? %2 p)))]

  (if (contains-all? BINGO redc_board) "WIN" "LOSE")))

das tests (⌐■_■)

(deftest fair-game? 
  (is (= "WIN" (bingo! [21 13 2 7 5 14 7 15 9 10]))
  (is (= "LOSE" (bingo!(vec (range 1 10)))) ;;just gettin' shwifty with the lists

(run-tests 'dailyChallenge.seventySix)