Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003730OCamlOCaml generalpublic2005-07-18 11:542012-03-24 15:01
Reporteradministrator 
Assigned Tofrisch 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0003730: Feature wish: Map.S.length, Map.S.max_key, Map.S.min_key
DescriptionFull_Name: Christoph Bauer
Version: 3.08.3
OS:
Submission from: 213.68.136.226 (213.68.136.226)


Hi,

Map.S.length : 'a t -> int

would be nice. Should return then number of elements in the given Map.

Furthermore:

Map.S.max_key : 'a t -> 'a
Map.S.min_key : 'a t -> 'a

max_key returns the greatest key in the map or raises Invalid_arg
for a empty map. This could be done efficiently only with the
internal representation of the map.

Thanks,
Christoph Bauer

TagsNo tags attached.
Attached Filesdiff file icon ocaml-map-patch.diff [^] (3,497 bytes) 2007-10-06 12:23 [Show Content]

- Relationships
child of 0000340closedfrisch Implementer dans Map les memes operations que dans Set 

-  Notes
(0003873)
berke (reporter)
2006-12-01 17:33

I second this.
Indeed, min_key and max_key would come in very handy.
These already exist in Set, so could we add those ?
Thanks.
(0004169)
berke (reporter)
2007-10-06 12:22
edited on: 2007-10-06 12:28

Here's a patch adding min_key, max_key, choose_key, choose, length and pairs. The last two could be defined efficiently by the user with fold, however the first three cannot.

Also see 0003876 (asks for Map.keys which can be done with fold or the proposed Map.pairs), 0003875 for Map.filter (doable with fold), 0003562 and 0000340 (which asks for Set -like functions), 0001297 which contributes a patch with union, elements, min_elt.

I suggest 0001297 be integrated.

(0005509)
frisch (developer)
2010-05-25 15:34

Rev 10468 introduces new functions that can be used to simulate efficiently the desired functionality (min_binding, max_binding).

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2006-12-01 17:33 berke Note Added: 0003873
2007-10-06 12:22 berke Note Added: 0004169
2007-10-06 12:23 berke File Added: ocaml-map-patch.diff
2007-10-06 12:28 berke Note Edited: 0004169
2008-01-22 17:06 doligez Relationship added child of 0000340
2010-05-25 15:34 frisch Note Added: 0005509
2010-05-25 15:34 frisch Status acknowledged => resolved
2010-05-25 15:34 frisch Resolution open => fixed
2010-05-25 15:34 frisch Assigned To => frisch
2012-03-24 15:01 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker