Thanks all persons for the help and patience with me.
Roelof
Op maandag 27 oktober 2014 22:23:50 UTC+1 schreef James Reeves:
> Right. It's similar to writing:
>
> (def x 5)
>
> (= #{x} #{5})
>
> You'd expect that to be true, right?
>
>
> When Clojure comes across an unquoted symbol (like x or
Right. It's similar to writing:
(def x 5)
(= #{x} #{5})
You'd expect that to be true, right?
When Clojure comes across an unquoted symbol (like x or octavia), it tries
to evaluate it, replacing it with the value it represents.
In a similar way, unquoted lists (anything in parentheses) are als
Np, So if I understand it right. I see the first one in repl.
Because midje has #{octavia} and in another function is stated :
(def octavia {:name "Octavia E. Butler"
:birth-year 1947
:death-year 2006})
clojure makes from the first {octavia} the second {:name "Octa
Sorry, I misplaced a couple of brackets:
(= {:title "Wild Seed", :authors #{{:name "Octavia E. Butler", :birth-year
1947, :death-year 2006}}}
{:title "Wild Seed", :authors #{octavia}})
That should work.
- James
On 27 October 2014 20:20, Roelof Wobben wrote:
> nope, there is somewhere a err
nope, there is somewhere a error in the example.
When I copie it as you made it then I see this error message :
RuntimeException Unmatched delimiter: } clojure.lang.Util.runtimeException
(Util.java:219)
when I add a extra ) I see this message :
RuntimeException Map literal must contain an
On 27 October 2014 19:37, Roelof Wobben wrote:
> of course I can.
>
> If I look at answers other people gives then this is the solution :
>
> (defn old-book->new-book [book]
> (assoc book :authors (set (book :authors)))
> )
>
> and then according to the explanation I would see this output ;
>
>
of course I can.
If I look at answers other people gives then this is the solution :
(defn old-book->new-book [book]
(assoc book :authors (set (book :authors)))
)
and then according to the explanation I would see this output ;
(old-book->new-book {:title "Wild Seed", :authors [octavia]});=
On 27 October 2014 19:16, Roelof Wobben wrote:
> Wierd, also on 1.5.1 I see the same output as 1.6.0.
>
> So there is a error in the page or the test are not checking it properly .
>
Could you explain what you think is an error? Your messages are a little
cryptic.
- James
--
You received thi
Wierd, also on 1.5.1 I see the same output as 1.6.0.
So there is a error in the page or the test are not checking it properly .
Pity, this is a way I like to learn.
Roelof
Op maandag 27 oktober 2014 18:03:29 UTC+1 schreef Roelof Wobben:
> Thanks.
>
> I did a peek at the answer and it seems
Thanks.
I did a peek at the answer and it seems that this one do make it work.
(defn old-book->new-book [book]
(let [authors (get book :authors)]
(assoc book :authors (set authors
Roelof
Edit 1 : I think I found it. The course is in 1.5.1 and im not trying it in
1.6.0
Op maandag
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
wrote:
> Op maandag 27 oktober 2014 16:
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 thin
Op maandag 27 oktober 2014 16:37:49 UTC+1 schreef James Reeves:
>
> On 27 October 2014 13:45, Roelof Wobben >
> wrote:
>
>> Hello,
>>
>> I have this "facts".
>>
>> (def octavia {:name "Octavia E. Butler"
>> :birth-year 1947
>> :death-year 2006})
>>
>>
> So you've as
On 27 October 2014 13:45, Roelof Wobben 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. Bu
The hash map you posted has the value of [octavia] under the key :authors, and
that's what printed out. The repl doesnt inline the variable name, instead it
prints out the literal value.
On Mon, Oct 27, 2014 at 9:22 AM, Roelof Wobben
wrote:
> Op maandag 27 oktober 2014 16:07:15 UTC+1 schreef G
Op maandag 27 oktober 2014 16:07:15 UTC+1 schreef Gary Verhaegen:
>
> On Monday, 27 October 2014, Roelof Wobben > wrote:
>
>> Now Im complete confused. I never succeed in reading the value of authors
>> so I can do the set command.
>>
>> Roelof
>>
>
> And now you're kind of confusing me. What
On Monday, 27 October 2014, Roelof Wobben wrote:
> Now Im complete confused. I never succeed in reading the value of authors
> so I can do the set command.
>
> Roelof
>
And now you're kind of confusing me. What makes you think you do not read
the value of authors? What did you expect instead of
Now Im complete confused. I never succeed in reading the value of authors
so I can do the set command.
Roelof
Op maandag 27 oktober 2014 15:50:05 UTC+1 schreef Gary Verhaegen:
> You do read it. You just don't turn it into a set. To turn a vector into a
> set, you can use the set function: (s
You do read it. You just don't turn it into a set. To turn a vector into a
set, you can use the set function: (set [octavia]).
On Monday, 27 October 2014, Roelof Wobben wrote:
> correct,
>
> What I try to achieve is to read the vector called authors and convert it
> into a set later.
> So I thou
correct,
What I try to achieve is to read the vector called authors and convert it
into a set later.
So I thought i could read the contents of author with what I have put into
my orginal question but apperently I made a thinking error.
So back to the drawing table. :(
Roelof
Op maandag 2
I am unsure of your question then - what you pasted is correct.
On the linked page it shows a slightly different output:
(old-book->new-book {:title "Wild Seed", :authors [octavia]})
;=> {:title "Wild Seed", :authors #{octavia}}
The "#{}" syntax is a literal set, that is all. It isn't renderin
Nope, the exercise I stated this :
(old-book->new-book {:title "Wild Seed", :authors [octavia]})
See exercise 22 on this page :
http://iloveponies.github.io/120-hour-epic-sax-marathon/structured-data.html#exercise-22
Roelof
Op maandag 27 oktober 2014 14:52:23 UTC+1 schreef Colin Yates:
>
(get book :authors) is saying "return the value of the ":authors" key in
the "book" map. You provided {:title... :authors [octavia]} as the "book"
map, the value of "authors" being a vector with a single element. That
single element being "{:name "Octavia E. Butler"
:birth-year 19
23 matches
Mail list logo