diff --git a/otus-02/src/otus_02/homework/palindrome.clj b/otus-02/src/otus_02/homework/palindrome.clj index dd3d8a4..a879e59 100644 --- a/otus-02/src/otus_02/homework/palindrome.clj +++ b/otus-02/src/otus_02/homework/palindrome.clj @@ -1,4 +1,6 @@ -(ns otus-02.homework.palindrome) +(ns otus-02.homework.palindrome + (:require [clojure.string :as str])) - -(defn is-palindrome [test-string]) +(defn is-palindrome [test-string] + (let [prepared-str (str/lower-case (str/replace test-string #"\W" ""))] + (= prepared-str (str/reverse prepared-str)))) diff --git a/otus-02/src/otus_02/homework/pangram.clj b/otus-02/src/otus_02/homework/pangram.clj index cc35c99..f520e87 100644 --- a/otus-02/src/otus_02/homework/pangram.clj +++ b/otus-02/src/otus_02/homework/pangram.clj @@ -1,4 +1,8 @@ -(ns otus-02.homework.pangram) +(ns otus-02.homework.pangram + (:require [clojure.string :as str])) - -(defn is-pangram [test-string]) +(defn is-pangram [test-string] + (let [alphabet (vec "abcdefghijklmnopqrstuvwxyz")] + (= alphabet + (sort (distinct + (str/lower-case (str/replace test-string #"\W" "")))))))