Hello, newbie question here. :)

I'm writing a Tetris game to teach myself Clojure, and I'm trying to
keep the code ideomatic as I go along.
One of the most basic parts of the underlying model is representing
the pieces and playing field as two dimensional matrices.

This is an L shaped playing piece (represented by a two dimensional
vector literal):

(def L-shape
[
  [0 1 0 0]
  [0 1 0 0]
  [0 1 1 0]
  [0 0 0 0]
])

I want to check if other matrices of same size have the same shape,
ie. are the 1's and 0's in the same places in the compared matrix?

I suppose the most straight-forward way is write a function which
steps through the two matrices simultaneously, comparing
corresponding elements one by one.

My question: is there a more elegant way of determining equivalence of
collection structures like these in Clojure?


--
Cheers,
Thomas Kjeldahl Nilsson
http://kjeldahlnilsson.net

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