On Wednesday, October 3, 2012 4:44:44 AM UTC-4, puzzler wrote:
>
> It is surprising at first, but since vectors are used so commonly in 
> Clojure instead of lists to represent literal sequential collections of 
> data, it turns out to be extremely convenient to be able to compare it for 
> equality against sequential collections generated as lists or lazy 
> sequences.  Basically, all those things are just flat, linear collections, 
> and what we really care about from an equality standpoint is whether the 
> collections have the same elements in the same order.  Clojure similarly 
> considers different types of maps (hash-maps, array-maps, sorted-maps) to 
> be equal if the associations are the same.  Ditto for hash-sets and 
> sorted-sets.
>
>
>
Out of curiosity, if we want to check if two collections has the same 
structure/type and elements, namely if I want 
(my-equal  [1 2 3 4 '(5)]  [1 2 3 4 [5]]) => false
(my-equal  [1 2 3 4 [5]]  [1 2 3 4 [5]]) => true

Is there any convenient way to do that? Thank you.

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