Thanks,
I already understand what happens now.
Im now trying to find a way to convert this
:authors [octavia] to :authors #{octavia}
Somehow I have to use set I think but I have to figure out how .
Roelof
Op maandag 27 oktober 2014 16:48:10 UTC+1 schreef Ashton Kemerling:
> I think you're confused on the terminal output. Try typing [octavia] in
> the repl, and compare the output you get to the above code.
>
> Clojure prints out the raw values of any computation, not variable names.
>
>
>
> On Mon, Oct 27, 2014 at 9:45 AM, Roelof Wobben <[email protected]
> <javascript:>> wrote:
>
>>
>>
>> Op maandag 27 oktober 2014 16:37:49 UTC+1 schreef James Reeves:
>>>
>>> On 27 October 2014 13:45, Roelof Wobben <[email protected]> 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
>>>
>>>
>>
>> I think I do not fully understand how clojure works as a beginner.
>> As far as I see it I have to find a way to stop with [octavia] so I can
>> make a set of it.
>>
>> Roelof
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected]
>> <javascript:>
>> 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] <javascript:>
>> 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 [email protected] <javascript:>.
>> 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 [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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.