maybe you should do this:

(defn add-author [book new-author]
   (update-in book [:authors] conj new-author)

Thanks,
Di Xu

2014-10-29 19:01 GMT+08:00 Roelof Wobben <rwob...@hotmail.com>:

> Hello,
>
> For a exercise I have to add something to the end of a existing map.
>
> So I thought this would work :
>
> (defn add-author [book new-author]
>   (assoc book (conj :authors new-author)))
>
> and call the function with :
>
> (add-author little-schemer {:name "Gerald J. Sussman"})
>
>
> then I see this error message :
>
>
> ClassCastException clojure.lang.Keyword cannot be cast to 
> clojure.lang.IPersistentCollection  clojure.core/conj (core.clj:83)
>
>
> Roelof
>
>
>
>
>  --
> 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