> I am receiving a sequence from a particular function so I want to get that > sequence and converted to a vector o I can return a vector instead. > > (defn get-events-hlpr [] > "Retrieves events from MongoDB." > (init) > (def items (mc/find-maps "events")) ;; get the sequence > (loop [vtr [] > data items] > (if (zero? (count data)) > vtr > (recur > (conj vtr (dissoc (first data) :_id))(rest data))))) > > Is the right way?
Why do you want to return a vector? Do you absolutely need some of the features that only vectors can provide (indexing, etc.)? Nevertheless, the code that you wrote is not correct in the Clojure world. `def` creates a top-level var and that should be only used to store `global` bindings; `def` is not a way to declare variables. You should write the code like this instead - (init) ;; outside, preferably called only once during app initialisation (defn get-events-hlpr [] "Retrieves events from MongoDB." (vec (mc/find-maps "events"))) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en