I would like to the function (string-place-typeII) to return the value from (calculate-distance-matrix) like this: {:distance "5 km" :duration "2 mins"} on each loop or better still pass it to some variable enclosed in {} so I can return all of it at the end of the loop.
List of functions:
(defn get-placetypes
""
[] (into-array (PlaceType/values )) )
(defn get-all-placetypes
""
[x]
(def my-vector (get-placetypes))
(let [[& the-rest] my-vector]
(nth the-rest x) ))
(defn string-place-typeII
""
[]
(doseq [n (get-placetypes)]
(calculate-distance-matrix 2 (define-context API-KEY) n))
)
(defn calculate-distance-matrix
""
[property-id context place-type]
;(def nearby-search-fucntion )
(let [r (. (. (. (DistanceMatrixApi/newRequest
context)
origins (into-array [(coordinates->keys property-id context)] ))
destinations (into-array [(m/latlng (do-nearby-search property-id context place-type))])) await)]
{:distance (-> r
.rows
first
.elements
first
.distance
.humanReadable)
:duration (-> r
.rows
first
.elements
first
.duration
.humanReadable)})
How to I make the (string-place-typeII) return the value of (calculate-distance-matrix) like this {:distance "5 km" :duration "2 mins"} on each iteration?
mapinstead ofdoseq? I usedoseqonly when 1. the body ofdoseqproduces some side effects, 2. I don't have anything to be returned from there