Exercism: clean and format a phone number in Clojure Problem statement


  Phone Number
  
  Write a program that cleans up user-entered phone numbers so that they can be sent SMS messages.
  
  The rules are as follows:
  
  
  If the phone number is less than 10 digits assume that it is bad number
  If the phone number is 10 digits assume that it is good
  If the phone number is 11 digits and the first number is 1, trim the 1 and use the last 10 digits
  If the phone number is 11 digits and the first number is not 1, then it is a bad number
  If the phone number is more than 11 digits assume that it is a bad number
  


Proposed Solution

(ns phone-number
  (:require [clojure.string :as str]))

(def non-digits #"\D")
(def parts #"^1?(...)(...)(....)$")
(def error-val ["000" "000" "0000"])

(defn- digits [n] (str/replace n non-digits ""))

(defn- trio-h [n]
  (if-let [ps (re-find parts n)]
    (rest ps)
    error-val))

(defn- trio [n] (-&gt; n digits trio-h))

(defn number [n] (-&gt; n trio str/join))

(defn area-code [n] (-&gt; n trio first))

(defn pretty-print [n]
  (let [[area exch line] (trio n)]
    (format "(%s) %s-%s" area exch line)))


Questions


In pretty-print is the use of let necessary? Or is there a way in Clojure to splice in the result of (trio n) in-place for the call to format? The result of (trio n) is a vector containing three strings and the format call is expecting three %s strings to stick into the format string. If there is an alternative to my use of let, which is preferred?
Are the names ok? Do they read like Clojure names? Is there a convention for naming a one-off helper function? 
Is it better to keep trio-h a separate helper function, or let it inside the using function, or would you just use the code in-place instead?
:refering clojure.string/replace triggers a warning (since it collides with clojure.core/replace) so I :refered all of clojure.string. Is there a way to :refer as to avoid the collision?
Do you have other improvements you could suggest?


Tests

See the Exercism page for the Phone Number problem in Clojure
I'm still learning clojure, but I'll contribute what I can.


I don't know if it is prefered or not, but if you wanted to get rid of the let, you could do something like (apply (partial format "(%s) %s-%s") trio) or (apply format (concat '["(%s) %s-%s"] trio)) instead.
Naming seems ok.
No comment.
I don't know.
Your regex for parts is suboptimal.  '.' will pick up any character, but you really only want digits.  Something like "^1?(\d{3})(\d{3})(\d{4})$" would be more accurate.