Skip to content

Commit

Permalink
Add q70
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkun committed Sep 15, 2024
1 parent 646d386 commit 563959c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ex/q070.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
;; https://4clojure.oxal.org/#/problem/070

(ns ex.q070)

(defn ans
"Problem 70, Word Sorting"
[sentence]
(sort-by #(.toLowerCase %) (re-seq #"\w+" sentence)))
14 changes: 14 additions & 0 deletions test/ex/q070_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
;; https://4clojure.oxal.org/#/problem/070

(ns ex.q070-test
(:require [clojure.test :as t]
[ex.q070 :as sut]))

(t/deftest test-q70
(t/testing "Problem 70, Word Sorting"
(t/is (= ["a" "day" "Have" "nice"]
(sut/ans "Have a nice day.")))
(t/is (= ["a" "Clojure" "fun" "is" "language"]
(sut/ans "Clojure is a fun language!")))
(t/is (= ["fall" "follies" "foolish" "Fools" "for"]
(sut/ans "Fools fall for foolish follies.")))))

0 comments on commit 563959c

Please sign in to comment.