Skip to content

Commit

Permalink
refactor(clojure): prefer built-in last method
Browse files Browse the repository at this point in the history
  • Loading branch information
choznerol committed Nov 9, 2021
1 parent f6a4a60 commit 4027259
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions platform/clojure/mailchecker.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,10 @@
[email]
(str/split email #"@"))

(defn last-element
"Returns the last element of the arr"
[arr]
(first
(take-last 1 arr)))

(defn domain-part
"Returns the domain part from email"
[email]
(last-element (at-split email)))
(last (at-split email)))

(defn dot-join
"Returns string from arr joined with dot char"
Expand Down
8 changes: 1 addition & 7 deletions platform/clojure/mailchecker.tmpl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,10 @@
[email]
(str/split email #"@"))

(defn last-element
"Returns the last element of the arr"
[arr]
(first
(take-last 1 arr)))

(defn domain-part
"Returns the domain part from email"
[email]
(last-element (at-split email)))
(last (at-split email)))

(defn dot-join
"Returns string from arr joined with dot char"
Expand Down

0 comments on commit 4027259

Please sign in to comment.