#1 new
bahuvrihi

add remove to library

Reported by bahuvrihi | June 29th, 2008 @ 08:57 AM | in Constants 1.0

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.

Comments and changes to this ticket

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Libraries of physical and chemical constants for scientific calculations in Ruby.

People watching this ticket

Tags

Pages