
22 May
2007
22 May
'07
5:41 p.m.
On Tue, May 22, 2007 at 10:28:24AM -0700, Adam Langley wrote:
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.
nearest needs Num, but the other two shouldn't.