octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49559] Implementation of containers.Map


From: Guillaume
Subject: [Octave-bug-tracker] [bug #49559] Implementation of containers.Map
Date: Mon, 27 Mar 2017 07:47:38 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0

Follow-up Comment #9, bug #49559 (project octave):

I am attaching a new version of a possible implementation of containers.Map
with many changes:
* more documentation,
* more tests,
* improved validation of inputs for better compatibility with Matlab,
* use of a struct instead of a cell vector to store key/value pairs. Numeric
arrays are converted to strings using typecast/num2hex, using a suggestion
from jwe.

It requires reviewing and some code refactoring might be possible for the
validation of user-provided keys or values.

According to the documentation, keys are not sorted but in practice they are.
This implementation does the same. There is still however an issue with
negative numbers (sort takes place on num2hex'ed keys) so unless there is a
better solution, a way to fix this is modify private methods
encode_keys/decode_keys to implement the approach described here:
http://brownbag.springmetrics.com/2012/05/making-numbers-sortable/

(file #40168)
    _______________________________________________________

Additional Item Attachment:

File name: Map.m                          Size:18 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49559>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]