Hi,

I am currently reading "Programming Clojure" but got stuck at the
destructuring done in the "head-overlaps-body?" function call that is
part of the "snake" game:

(defn head-overlaps-body? [{[head & body] :body}]
  (includes? body head))

;; page 200 of the pdf version

I can not figure out what {[head & body] :body} actually means here.

"head-overlaps-body?" is called inside "lose?" which is called with a
"snake" object:

(def lose? head-overlaps-body?)

(defn create-snake []
  {:body (list [1 1])
   :dir [1 0]
   :type :snake
   :color (Color. 15 160 70)})

I read the the information about the "let" binding form on clojure.org/
special_forms but still have no clue how the above destructuring is
done.

Hope someone can give me a hint.

Stefan

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

Reply via email to