File tree 3 files changed +7
-1
lines changed 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
6
6
7
7
He answers 'Whoa, chill out!' if you yell at him.
8
8
9
+ He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
10
+
9
11
He says 'Fine. Be that way!' if you address him without actually saying
10
12
anything.
11
13
Original file line number Diff line number Diff line change 10
10
(defn- shouting? [msg] (and (= msg (str/upper-case msg))
11
11
(has-letter? msg)))
12
12
13
+ (defn- forceful-question? [msg]
14
+ (and (shouting? msg) (question? msg)))
15
+
13
16
(defn response-for [input]
14
17
(cond
18
+ (forceful-question? input) " Calm down, I know what I'm doing!"
15
19
(silence? input) " Fine. Be that way!"
16
20
(shouting? input) " Whoa, chill out!"
17
21
(question? input) " Sure."
Original file line number Diff line number Diff line change 20
20
(bob/response-for " It's OK if you don't want to go to the DMV." ))))
21
21
22
22
(deftest responds-to-forceful-questions
23
- (is (= " Whoa, chill out !"
23
+ (is (= " Calm down, I know what I'm doing !"
24
24
(bob/response-for " WHAT THE HELL WERE YOU THINKING?" ))))
25
25
26
26
(deftest responds-to-shouting-with-special-characters
You can’t perform that action at this time.
0 commit comments