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