Sha256: 723d277bc8b5de0a6c4b94348a829af2ddf74950a9ba84c581bd92e39ccfbd32

Contents?: true

Size: 641 Bytes

Versions: 28

Compression:

Stored size: 641 Bytes

Contents

(ns bob
  (:require [clojure.string :as str]))

(defn- silence?    [msg] (str/blank? msg))

(defn- question?   [msg] (= \? (last msg)))

(defn- has-letter? [msg] (some #(Character/isLetter (int %)) msg))

(defn- shouting?   [msg] (and (= msg (str/upper-case msg))
                              (has-letter? msg)))

(defn- forceful-question? [msg]
  (and (shouting? msg) (question? msg)))

(defn response-for [input]
  (cond
    (forceful-question? input) "Calm down, I know what I'm doing!"
    (silence?  input) "Fine. Be that way!"
    (shouting? input) "Whoa, chill out!"
    (question? input) "Sure."
    :else             "Whatever."))

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.179 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.178 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.177 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.176 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.175 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.174 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.173 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.172 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.171 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.170 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.169 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.167 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.166 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.165 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.164 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.163 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.162 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.161 tracks/clojure/exercises/bob/src/example.clj
trackler-2.2.1.160 tracks/clojure/exercises/bob/src/example.clj