On Jul 21, 10:15 pm, Ken Wesson <[email protected]> wrote:
> On Thu, Jul 21, 2011 at 10:13 PM, Ken Wesson <[email protected]> wrote:
> > On Thu, Jul 21, 2011 at 8:36 PM, octopusgrabbus
> > <[email protected]> wrote:
> >> And do you have a suggestion for a functional way?
Is all-csv-rows being re-bound with the results of [] and then
returned as the function's value? And again, thanks. This is exactly
what I was looking for.
(defn ret-params
"Generates all q-parameters and returns them in a vector of
vectors."
[all-csv-rows]
(reduce
(fn [param-vec one-full-csv-row]
(let [q-param (zipmap accumail-url-keys one-full-csv-row)
accu-q-param (first (rest (split-at 3 q-param)))
billing-param (first (split-at 3 q-param))]
(conj param-vec [accu-q-param billing-param])))
[]
all-csv-rows))
>
> > Yes. Change
>
> > (doseq [one-full-csv-row all-csv-rows]
> > (let [accumail-csv-row one-full-csv-row
> > q-param (zipmap accumail-url-keys accumail-csv-row)
> > accu-q-param (first (rest (split-at 3 q-param)))
> > billing-param (first (split-at 3 q-param))]
> > (conj param-vec accu-q-param billing-param)))
>
> > to
>
> > (reduce
> > (fn [one-full-csv-row]
> > (let [q-param (zipmap accumail-url-keys one-full-csv-row)
> > accu-q-param (first (rest (split-at 3 q-param)))
> > billing-param (first (split-at 3 q-param))]
> > [accu-q-param billing-param]))
> > []
> > all-csv-rows)
>
> Er, that's weird. I don't know what happened there. Obviously that should be
>
> (reduce
> (fn [param-vec one-full-csv-row]
> (let [q-param (zipmap accumail-url-keys one-full-csv-row)
> accu-q-param (first (rest (split-at 3 q-param)))
> billing-param (first (split-at 3 q-param))]
> (conj param-vec [accu-q-param billing-param])))
> []
> all-csv-rows)
>
> --
> Protege: What is this seething mass of parentheses?!
> Master: Your father's Lisp REPL. This is the language of a true
> hacker. Not as clumsy or random as C++; a language for a more
> civilized age.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en