In other languages, curly braces are used to enclose executable
statements, so something like { println("Hello world\n"); } makes sense.
In Clojure, however, curly braces are used to enclose a list of key/value
pairs, aka a map. So when you say
{hash-map :c "Turd" :d "More Turd"}
you are creating a data structure with 2 and a half pairs. The first pair
uses the function hash-map as the key, and :c as the value; then "Turd" as
the next key and :d as the value; then "More Turd" as the last key, and no
value, causing the error.
On Sun, Dec 4, 2016 at 3:18 PM, bill nom nom <[email protected]>
wrote:
> ;; This works,
> (hash-map :a 1 :b 2 )
>
>
> ;; Here's another way to create a hash map, this won't work because map
> ;; literal must contain even number of forms
> {hash-map :c "Turd" :d "More Turd"}
>
> What does "Map literal must contain an even number of forms" mean?
>
> --
> 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.
>
--
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.