clojure-greece

greenonion 2017-12-01T13:54:21.000275Z

ξεκινησε το advent

greenonion 2017-12-01T13:54:36.000365Z

η πρωτη ηταν ευκολη αλλα ωραιο να τη λυνεις με clj

orestis 2017-12-01T15:09:53.000173Z

#adventofcode 🙂

greenonion 2017-12-01T15:16:19.000415Z

ωραια φαση με τα inline tests @orestis

greenonion 2017-12-01T15:16:24.000704Z

εγω το προσεγγισα ετσι

stathissideris 2017-12-01T16:33:52.000455Z

@greenonion

(as-> "91212129" $
  (mapv #(Character/getNumericValue %) $)
  (conj $ (first $))
  (partition 2 1 $)
  (remove #(apply not= %) $)
  (map first $)
  (apply + $))

stathissideris 2017-12-01T16:40:23.000519Z

gia to 1o star toulaxiston

greenonion 2017-12-01T19:08:58.000432Z

Ωραίο κι αυτό

greenonion 2017-12-01T19:09:08.000816Z

Κανονικά θέλει transducers όμως :D

apod 2017-12-01T20:30:04.000110Z

kai ego tora to ekana plaka eixe, to ekana me alli logiki me reduce kai indexes 😛

apod 2017-12-01T20:30:38.000012Z

(defn captcha-solver
  ([s] (captcha-solver s 1))
  ([s step]
   (let [cycled (cycle s)]
     (reduce (fn [acc [i current]]
               (let [next (nth cycled (+ i step))]
                 (if (= next current)
                   (+ acc (Character/getNumericValue current))
                   acc))) 0 (keep-indexed vector s)))))