Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000576OCamlOCaml generalpublic2001-10-13 10:172014-06-23 15:08
Reporteradministrator 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000576: Suggestion: add_new to map
Descriptionsame definition as Map.add, except that it will throw an exception if the
key already exists. (I think that this should have been the default
behaviour of add, and the current add should have been called replace)

    let rec add x data = function
        Empty ->
          Node(Empty, x, data, Empty, 1)
      | Node(l, v, d, r, h) as t ->
          let c = Ord.compare x v in
          if c = 0 then
            raise XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
          else if c < 0 then
            bal (add x data l) v d r
          else
            bal l v d (add x data r)

/mattias

Tagsjunior_job, patch
Attached Filespatch file icon Map.add_new.2.patch [^] (3,189 bytes) 2014-06-19 21:40 [Show Content]

- Relationships
related to 0000340closedfrisch Implementer dans Map les memes operations que dans Set 

-  Notes
(0000116)
administrator (administrator)
2002-11-13 16:20

Reasonable suggestion. Find good name?
(0011761)
thizanne (reporter)
2014-06-19 21:40

Please ignore Map.add_new.patch (no test). Map.add_new.2.patch solves this (and there is a test).

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2008-02-19 15:01 doligez Relationship added related to 0000340
2013-08-30 22:02 doligez Tag Attached: junior_job
2013-08-30 22:02 doligez Tag Attached: patch
2014-06-19 20:32 thizanne File Added: Map.add_new.patch
2014-06-19 21:40 thizanne Note Added: 0011761
2014-06-19 21:40 thizanne File Added: Map.add_new.2.patch
2014-06-19 23:52 gasche File Deleted: Map.add_new.patch


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker