It's worth mentioning that ClojureScript does not have a MapEntry type.

Vectors implement IMapEntry using nth:

https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L3601-L3605

And empty returns an empty vector:

ClojureScript:cljs.user> (empty (first {:a 1}))
[]


On Saturday, July 19, 2014 10:44:12 PM UTC-4, Mike Fikes wrote:
>
> I did a little “code archaeology” in an attempt to elucidate what Rich may 
> had been thinking:
>
> In mid 2007, some of the persistent collection implementations had an 
> EMPTY value defined. [1, 2]. (But, of course, no such EMPTY value was 
> defined for MapEntrys.)
>
> Around a year later, MapEntrys were revised to participate in the vector 
> abstraction [3].
>
> A couple of months *after* this, “empty” was added to the collection 
> abstraction [4], and usually implemented in terms of the EMPTY value, and 
> MapEntry was made to return null.
>
> My analysis is inconclusive: Making MapEntry return null is logical, given 
> that there is no EMPTY value to return. But, the MapEntry / vector business 
> happening prior to this blurs the argument.
>
> Perhaps the real problem is that not all collections can be emptied, and 
> thus thus empty shouldn't have been added to the collection abstraction. 
> (ClojureScript separates out the idea, introducing IEmptyableCollection.)
>
> [1] 
> https://github.com/clojure/clojure/commit/12457e7bf29747232bbfda2a0de3b72fbb14f3a9
> [2] 
> https://github.com/clojure/clojure/commit/4232de83a53e12741252d31aef9cecee5b8981da
> [3] 
> https://github.com/clojure/clojure/commit/978af02b0a7e2b430c917b32b58215edcae2ad2d
> [4] 
> https://github.com/clojure/clojure/commit/697b69fe9c8f5e2e8d40382e70d4ddd490c4a9ee
>

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