Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

add remove to library

#1

For completeness it would be nice to have a remove method for library. Removing from values is easy (values are intended to be unique). The issue is removing from indexes and collections.

Index

Remove from index should:

  • remove value from key
  • downgrade StashArray to value if length == 1
  • remove empty keys

Collection

Remove from collection should:

  • remove value from key
  • downgrade StashArray to value if length == 1
  • replace empty keys with nil
  • trim array of trailing nils

In both cases I suppose the idea is to recalculate the key based on the value. This becomes problematic when values map to alternate values...

In collections, an additional issue arises for order. Which value maps when? You could determine this from the index of the values removed.

A slower alternative would be to remove the value and recalculate all indexes and collections. This approach is solid at the expense of speed.

Reported by bahuvrihi · June 29th, 2008 @ 08:57 AM

State: new
Milestone: Constants 1.0
Assigned to: nobody

Activity

  1. bahuvrihi
  2. bahuvrihi
    bahuvrihi
    • Milestone set to Constants 1.0

    July 30th, 2008 @ 08:46 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.