Parsing string into hash-map with 2D coordinates as keys I had never programmed in a functional programming language before. I think that this function has large nesting. Is there way to rewrite it better? I am most worried about the use of "flatten". Is there way to get rid of it? Also, is the indentation correct and does the function name correspond to Clojure naming style?

(defrecord Point [x y])
(def delimiter #" ")

(defn str-&gt;cells
  "Converts string with cells separated with 
  delimiter and new lines to Points hash map"
  [^String s]
  {:pre [(re-matches #"^((?:^|\s)(?:.|\s)(?=\s|$))+$" s)]}
  (apply
    hash-map
    (flatten
      (map-indexed
        (fn [y line]
          (map-indexed
            (fn [x value] [(Point. x y) value])
            (str/split line delimiter)))
        (str/split-lines s)))))

;; Example of use:
(str-&gt;cells "1 2\n3")  ;; -&gt; {#Point{:x 1, :y 0} "2", #Point{:x 0, :y 0} #Point{:x 0, :y 1} "3"}
Since there is no answers, I'll post my new version of code:

(defn line-&gt;cells
  "Converts string with cells to sequence of maps of Points
  It is str-&gt;cells helper, so it requires y argument."
  [str-&gt;value ^Long y ^String line]
  {:pre [(re-matches #"^((?:^| )(?:.+?| )(?= |$))+$" line)]}
  (map-indexed
    (fn [x value] {(Point. x y) (str-&gt;value value)})
    (str/split line #" ")))

(defn str-&gt;cells
  "Converts string with cells separated with
  delimiter and new lines to Points hash map"
  [^String s str-&gt;value]
  {:pre [(re-matches #"^((?:^|\s)(?:.+?| )(?=\s|$))+$" s)]}
  (-&gt;&gt; s
       (str/split-lines)
       (map-indexed (partial line-&gt;cells str-&gt;value))
       (flatten)
       (into {})))