Nathan Sorenson
unread,Sep 27, 2011, 1:54:21 PM9/27/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to clo...@googlegroups.com
You're right that my use isn't strictly returning a collection with a size of zero-- I'm treating empty more like 'default'. I'm thinking of its use in clojure.walk, which simply creates a
"blank" version of an arbitrary collection in which to place the altered
sub-forms. I can't find any other usages of 'empty' in the std lib.
I agree it's a bit of a mismatch, as 'walk' won't be able to alter the built-in keys of a record, but you wouldn't expect that to happen if you were using records.
Should IPersistentCollection even be defining 'empty', if one of the language's key data types doesn't support it? I think it would be better to either pull 'empty' into it's own protocol so clojure.walk doesn't match on IPersistentCollection when walking a data structure with the false expectation that it can create an empty version, or rename 'empty' it to something that records can implement, like 'default.'