   )
 
 
-(defn tally-die [dice]
-  (for [i (range 1 7)]
-    (apply + (for [die dice] (if (= die i) 1 0))))
-  )
+
 
 
 

                    (* 2))]
    (if (= nil result) 0 result)))

(defn get-first-tally [tallies value]
  (->> (range 0 6)
       (filter #(= value (nth tallies %)))
       (first)))

(defn yatzy [dice]
  (let [tallies (tally-die dice)]
    (if (= nil (get-first-tally tallies 5))
      0
      50)))


(defn three-of-a-kind [dice]
  (let [tallies (tally-die dice)
        result (first (remove nil?
            (for [i (range 0 6)]
              (if (>= (nth tallies i) 3)
                (* (+ i 1) 3)
                nil
                )
              )
            ))]
    (if (= nil result)
      0 result
      )
    )
  )




(defn four-of-a-kind [dice]
  (let [tallies (tally-die dice)
        result (->> (range 0 6)
                    (filter #(>= (nth tallies %) 4))
                    (map (fn [i] (* (+ i 1) 4)))
                    (first))]
    (if (= nil result) 0 result)))


(defn small-straight [dice]

  )

(defn fours [d1 d2 d3 d4 _5]
  (let [dice [d1 d2 d3 d4 _5]
        sum (apply +
           (for [at (range 0 5)]
             (if (= 4 (nth dice at)) 4 0)
             )
           )]
    sum
    )
  )


(defn fives_ [d1 d2 d3 d4 _5]
  (let [dice [d1 d2 d3 d4 _5]
        s (apply +
           (for [i (range 0 (count dice))]
             (if (= 5 (nth dice i)) 5 0)
             )
           )]
    s
    )
  )



(defn sixes [d1 d2 d3 d4 _5]
  (let [dice [d1 d2 d3 d4 _5]]
