<commit_before>(ns moon.core
    (:require-macros [cljs.core.async.macros :refer [go go-loop]])
    (:require [moon.dom :refer [set-html! by-id listen beep ping]]
              [cljs.moon.components :as components]
              [om.core :as om]              
              [goog.events :as events]
              [goog.history.EventType :as EventType]
              [secretary.core :as secretary :refer-macros [defroute]]
              [cljs.core.async :refer
               [<! >!  timeout onto-chan chan put! take! alts! close!]])
    (:import goog.History))

(defonce app-state (atom {:workout [
                                    {:title "Double armed dead hang on front three fingers open handed"
                                     :holds [5]
                                     :duration 6
                                     :rest 120
                                     :repeat 3
                                     }
                                    {:title "Double armed dead hang on middle two fingers open handed"
                                     :holds [5]
                                     :duration 6
                                     :rest 90
                                     :repeat 2
                                     }
                                    {:title "Hang open handed on three fingers on one arm, decrease resistance as required until hang can be completed."
                                     :holds [2,5]
                                     :duration 6
                                     :rest 60
                                     :repeat 6
                                     }
                                    {:title "Rest"
                                     :duration 0
                                     :rest 300
                                     :repeat 1
                                     }
                                    {:title "Double armed hang on full crimp position, on a first joint edge"
                                     :holds [1,5]
                                     :duration 6
                                     :rest 90
                                     :repeat 3
                                     }
                                    {:title "Double armed hang on full crimp, this time slightly smaller than the last set, i.e., _ of the the finger tip."
                                     :holds [3,4]
                                     :duration 6
                                     :rest 90
                                     :repeat 3
                                     }
                                    {:title "Single arm hang on 1st joint edge, decrease resistance if required until hang can be completed."
                                     :holds [1, 4, 5]
                                     :duration 6
                                     :rest 60
                                     :repeat 6
                                     }
                                    {:title "Rest"
                                     :duration 0
                                     :rest 300
                                     :repeat 1
                                     }
                                    {:title "Single arm lock off at 90 degrees"
                                     :holds [1, 5]
                                     :duration 8
                                     :rest 120
                                     :repeat 6
                                     }
                                    {:title "Two one armed pull ups"
                                     :holds [1, 5]
                                     :rest 120
                                     :repeat 4
                                     }              
                                    {:title "Front levers"
                                     :holds [1]
                                     :duration 8
                                     :rest 120
                                     :repeat 3
                                     }              
                                    ]}))


(defn expand [{:keys [repeat] :as m}]
  (map-indexed  (fn [i coll] (assoc coll :count (inc i))) (take repeat (cycle [m]))))

(defmulti play :state)

(defmethod play :almost [_]
  (beep))

(defmethod play :done [_]
  (ping))

(defmethod play :default [s])

(defn done? [remaining]
  (let [state {:remaining remaining}]
    (cond (and (< remaining 4) (> remaining 0))
          (assoc state :state :almost)
          (= remaining 0)
          (assoc state :state :done))))

(defn wall-clock []
  (let [output (chan)]
    (go-loop []
      (<! (timeout 1000))
      (when (>! output :tick)
        (swap! app-state update-in [:total-duration] inc)
        (recur)))
    output))

(defn update-current [{:keys [duration rest] :as exercise} seconds]
  (merge exercise
         (if (<= seconds duration)
           {:activity :hang :remaining (- duration seconds)}
           {:activity :rest :remaining (- (+ rest duration) seconds)})))

(defn count-down [{:keys [duration rest clock-chan title] :as exercise}]
  (let [total (+ duration rest)]
    (when (= (:count exercise) 1)
      (swap! app-state assoc :workout (clojure.core/rest (:workout @app-state))))
    (go-loop [i 0]<commit_msg>adding beep on 30 and 10 sec as well<commit_after>(ns moon.core
    (:require-macros [cljs.core.async.macros :refer [go go-loop]])
    (:require [moon.dom :refer [set-html! by-id listen beep ping]]
              [cljs.moon.components :as components]
              [om.core :as om]              
              [goog.events :as events]
              [goog.history.EventType :as EventType]
              [secretary.core :as secretary :refer-macros [defroute]]
              [cljs.core.async :refer
               [<! >!  timeout onto-chan chan put! take! alts! close!]])
    (:import goog.History))

(defonce app-state (atom {:workout [
                                    {:title "Double armed dead hang on front three fingers open handed"
                                     :holds [5]
                                     :duration 6
                                     :rest 120
                                     :repeat 3
                                     }
                                    {:title "Double armed dead hang on middle two fingers open handed"
                                     :holds [5]
                                     :duration 6
                                     :rest 90
                                     :repeat 2
                                     }
                                    {:title "Hang open handed on three fingers on one arm, decrease resistance as required until hang can be completed."
                                     :holds [2,5]
                                     :duration 6
                                     :rest 60
                                     :repeat 6
                                     }
                                    {:title "Rest"
                                     :duration 0
                                     :rest 300
                                     :repeat 1
                                     }
                                    {:title "Double armed hang on full crimp position, on a first joint edge"
                                     :holds [1,5]
                                     :duration 6
                                     :rest 90
                                     :repeat 3
                                     }
                                    {:title "Double armed hang on full crimp, this time slightly smaller than the last set, i.e., _ of the the finger tip."
                                     :holds [3,4]
                                     :duration 6
                                     :rest 90
                                     :repeat 3
                                     }
                                    {:title "Single arm hang on 1st joint edge, decrease resistance if required until hang can be completed."
                                     :holds [1, 4, 5]
                                     :duration 6
                                     :rest 60
                                     :repeat 6
                                     }
                                    {:title "Rest"
                                     :duration 0
                                     :rest 300
                                     :repeat 1
                                     }
                                    {:title "Single arm lock off at 90 degrees"
                                     :holds [1, 5]
                                     :duration 8
                                     :rest 120
                                     :repeat 6
                                     }
                                    {:title "Two one armed pull ups"
                                     :holds [1, 5]
                                     :rest 120
                                     :repeat 4
                                     }              
                                    {:title "Front levers"
                                     :holds [1]
                                     :duration 8
                                     :rest 120
                                     :repeat 3
                                     }              
                                    ]}))


(defn expand [{:keys [repeat] :as m}]
  (map-indexed  (fn [i coll] (assoc coll :count (inc i))) (take repeat (cycle [m]))))

(defmulti play :state)

(defmethod play :almost [_]
  (beep))

(defmethod play :done [_]
  (ping))

(defmethod play :default [s])

(defn done? [remaining]
  (let [state {:remaining remaining}]
    (cond (= remaining 30) (assoc :state :almost)
          (= remaining 10) (assoc :state :almost)
          (and (< remaining 4) (> remaining 0))
          (assoc state :state :almost)
          (= remaining 0)
          (assoc state :state :done))))

(defn wall-clock []
  (let [output (chan)]
    (go-loop []
      (<! (timeout 1000))
      (when (>! output :tick)
        (swap! app-state update-in [:total-duration] inc)
        (recur)))
    output))

(defn update-current [{:keys [duration rest] :as exercise} seconds]
  (merge exercise
         (if (<= seconds duration)
           {:activity :hang :remaining (- duration seconds)}
           {:activity :rest :remaining (- (+ rest duration) seconds)})))

(defn count-down [{:keys [duration rest clock-chan title] :as exercise}]
  (let [total (+ duration rest)]
    (when (= (:count exercise) 1)
      (swap! app-state assoc :workout (clojure.core/rest (:workout @app-state))))
    (go-loop [i 0]
{'fraction_non_alphanumeric': 0.07974038015762633, 'fraction_numerical': 0.01502086230876217, 'mean_word_length': 0.7304668698860902, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 132, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2451736', 'n_tokens_mistral': 2563, 'n_tokens_neox': 2257, 'n_words': 761}