Isn't the whole point of a struct that it guarantees that certain keys
are present?  I think the current behavior is correct.

On Dec 15, 5:21 am, Garth Sheldon-Coulson <g...@mit.edu> wrote:
> I wonder if the fact that this currently doesn't work the way you want it to
> is a necessary consequence of structural sharing and the desired performance
> guarantees of dissoc.
>
> In other words: I wonder if, on account of how struct maps are implemented
> (sort of like a vector, right?), the only way to get a hash map with one key
> gone is to do a linear copy of the struct map.
>
> If that's true (I have no idea if it is!), then there might be a reason for
> forcing you to do
>
> (dissoc (into {} mystruct) :akey)
>
> explicitly. Namely, it preserves the performance guarantees of dissoc.
>
> Garth
>
> On Tue, Dec 15, 2009 at 5:05 AM, ataggart <alex.tagg...@gmail.com> wrote:
>
> > On Dec 14, 11:23 pm, Richard Newman <holyg...@gmail.com> wrote:
> > > Something I keep bumping into: the SQL library returns rows as struct-
> > > maps. Often I want to do things like rename keys (:foo_bar => :foo-
> > > bar), strip out :id columns, etc.
>
> > > Nope!
>
> > >    java.lang.Exception: Can't remove struct key
>
> > > Any opinions on returning a hash-map after 'removing' (remember, these
> > > are persistent data structures) a key from a struct-map? They print
> > > the same, act the same... except in this instance.
>
> > So have (dissoc mystruct :akey) act like (dissoc (into {}
> > mystruct) :akey)?  Sounds reasonable to me.
>
> > --
> > 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<clojure%2bunsubscr...@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 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