DEV Community

Discussion on: Daily Challenge #75 - Set Alarm

Collapse
 
not_jffrydsr profile image
@nobody

crackin' out the ol' Clojure 🤔

(ns dailyChallenge.seventyFive)

(defn- setAlarm [& {:keys [employed? vacation?]}]
  "A vacation is what you take when you can no longer take what you've
   been taking - Wise Man #42"
  (cond 
    (and employed? vacation?) false
    (and employed? (not vacation?)) true))

don't test me 😗

(deftest sunrise_mutha_fcka
 (is (= true (setAlarm :employed? true :vacation? false))
 (is (= false (and
                (setAlarm :employed? false :vacation? false)
                (setAlarm :employed? true :vacation? true) 
                (setAlarm :employed? false :vacation? true)))))
                  ;;i don't know if you can be unemployed and temporarily away 
                  ;;from work | in fact, you can't. 🤔🤔🤔

(run-tests 'dailyChallenge.seventyFive)

at least with named non-positional parameters . . .

. . . there's less confusion about how silly this is 😂