darcs patch: Add proximal lookup functions in Map (and 2 more)

Adam Langley agl at imperialviolet.org
Tue May 22 13:28:24 EDT 2007


Please see attached 2 patches (and 1 misc patch) to Data.Map which add
the ability to lookup entries by proximity. For example, if I have a
Map which relates times to the state of a system at that time:
  let m = Map.fromList [(1, x), (10, y), (15, z)]
Then, if I want to find out the state at time 5:
  Map.nearestLesserOrEqual 5 m
  -> (1, x)

In a similar fashion, nearestGreaterOrEqual and nearest are also provided.

Thanks


AGL


Tue May 22 10:15:05 PDT 2007  agl at imperialviolet.org
  * Add proximal lookup functions in Map

  These functions require the key to be an instance of Num, because they use
  the numerical distance, |x-y|, to find elements in a map which are close to
  a query key. This is useful, for example, if the map is mapping times to
  state changes and you want to find out the state at any given time.


Tue May 22 10:16:00 PDT 2007  agl at imperialviolet.org
  * Update deprecated Debug.QuickCheck name

Tue May 22 10:16:28 PDT 2007  agl at imperialviolet.org
  * Add tests for proximal lookup functions

-- 
Adam Langley                                      agl at imperialviolet.org
http://www.imperialviolet.org                       650-283-9641
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 62692 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/libraries/attachments/20070522/de2fff9d/attachment-0001.bin


More information about the Libraries mailing list