
30 Apr
2011
30 Apr
'11
8:46 p.m.
El abr 30, 2011, a las 2:45 p.m., wren ng thornton escribió:
So why not just implement your "set" with a map from elements to their indices? Maps maintain uniqueness of keys, and Data.Map maintains ordering too. It wouldn't be as clean as the proposed functions, but from your description of the problem, it's not clear to me that using sets of proxies for array indices is really the cleanest approach in the first place.
Well, maps from elements to indexes was exactly the solution I had in mind at first, but then I looked at the docs for Data.Map and noticed that it had these Int index functions that did the trick for free, and that they were "missing" from Data.Set. So I thought, hey, maybe can I fix that... :-)