On 27 October 2014 13:45, Roelof Wobben <rwob...@hotmail.com> wrote:

> Hello,
>
> I have this "facts".
>
> (def octavia {:name "Octavia E. Butler"
>               :birth-year 1947
>               :death-year 2006})
>
>
So you've assigned the var "octavia" to the data structure:

{:death-year 2006, :name "Octavia E. Butler", :birth-year 1947}


(def wild-seed {:title "Wild Seed", :authors [octavia]})
>
>
Here you've assigned the var "wild-seed" to:

{:title "Wild Seed", :authors [octavia]}


Which is the same as:

{:title "Wild Seed", :authors [{:death-year 2006, :name "Octavia E.
Butler", :birth-year 1947}]}


So I thought when I do this :
>
> (defn old-book->new-book [book]
>    (get book :authors))
>
> (old-book->new-book {:title "Wild Seed", :authors [octavia]})
>
>
Okay, so work through your code. You start with:

(old-book->new-book {:title "Wild Seed", :authors [octavia]})


Resolving this gets:

(get {:title "Wild Seed", :authors [octavia]} :authors)


Resolving this gets:

[octavia]


Which resolves to:

[{:death-year 2006, :name "Octavia E. Butler", :birth-year 1947}]


I'm not sure why you'd expect anything else. Did you not expect "octavia"
to resolve?

- James

-- 
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