Thank you both for your replies, they were very helpful.
Regards,
Ryan
On Wednesday, October 31, 2012 2:29:11 AM UTC+2, Ryan T. wrote:
>
> Hello all,
>
> I have the following code:
>
> (def my-hash {"1" {:a-key {:value "a value"} :another-key "another value"
>>> :a-third-key []}
>>
>> "2" {:a-key {:value "a value"} :another-key "another
>>> value" :a-third-key []}}
>>
>>
> In the following example i get the following result:
>
> user=> (doseq [[id item] my-hash] (println item))
>
> {:a-key {:value a value}, :another-key another value, :a-third-key []}
>
> {:a-key {:value a value}, :another-key another value, :a-third-key []}
>
> nil
>
>
> On the above example, it looks *almost* normal to me. For instance, why
> *{:value
> a value}* is not returned as *{:value "a value"} *? Same goes for *:another
> key*
> It still looks like a hashmap though. Isn't it?
>
> The behavior however which confused me even more is the following:
>
> user=> (doseq [[id item] my-hash
>> key (:a-key item)]
>> (println key))
>> [:value a value]
>> [:value a value]
>> nil
>
>
> I was expecting the above to return:
>
> {:value "a value"}
>> {:value "a value"}
>> nil
>
>
> Can someone explain to me why vector is being returned and how can I
> achieve the result I was expecting? What am I missing here? Am i misusing
> the doseq <http://clojuredocs.org/clojure_core/clojure.core/doseq>bindings?
>
> Thank you for your time
>
--
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