Could you explain a little more what your end goal is?

It sounds like you want a map, but without knowing more about the purpose,
it's difficult to say.

- James


On 10 June 2014 16:43, Francesco Lunelli <francesco.lune...@gmail.com>
wrote:

> Hello everybody, I have a newbie question about destructuring and
> assigning and didn't find an answer in documentation or books.
>
> I have a list that contains an arbitrary number of elements for example
> '("one" "two" "three" ...) I now only that elements are strings.
>
> I need to to take every element and use it as the name of a variable
> inside a let and assign the result of a funcion on that element to that
> variable.
> Somthing like this for example:
>
> (let [one  (clojure.string/capitalize "one")
>       two (clojure.string/capitalize "two")
>       three (clojure.string/capitalize "three")]
>      ;; here I have access to vars one two three etc.
>       )
>
> where the names of the vars are taken from the list and values are
> obtained applying a function on the corresponding element of the list (the
> capitalize function il only an example, it could be everything else).
>
> If I do in this way
> (for [word ["the" "quick" "brown" "fox"]] (let [word
> (clojure.string/capitalize word)] (prn word)))
> it works, but I need to access the variables outside of the cycle for,
> after having defined and assigned everyone because I need to put in
> relation some of them.
>
> Thanks to everybody
>
> Francesco
>
>
>
>  --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to