Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006279OCamlOCaml standard librarypublic2013-12-21 14:322014-02-19 17:17
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version4.01.0 
Target VersionFixed in Version 
Descriptionwould be nice. I have already written the following a few times in my life:

module Sset = Set.Make(String)
let sset_map f s = Sset.fold (fun e acc -> Sset.add (f e) acc) s Sset.empty

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
braibant (reporter)
2014-01-30 21:54

Also, in the same vein, I find myself writing a "of_list" function quite often

module MSet = struct
  module Make(E:Set.OrderedType) =
    include Set.Make(E)
    let of_list l = List.fold_right (add) l empty

I agree that this is a one-liner, but a frequent one...
frisch (developer)
2014-02-04 11:12
edited on: 2014-02-04 11:13

@braibant: Set.of_list has already been added to trunk (will be available in OCaml 4.02), with a somewhat optimized implementation. See 0004986.

doligez (administrator)
2014-02-19 17:17
edited on: 2014-02-19 17:17

May I remind everyone that the best place for such functions is "extended" libraries like Batteries and Jane Street Core?

- Issue History
Date Modified Username Field Change
2013-12-21 14:32 dbuenzli New Issue
2014-01-30 21:54 braibant Note Added: 0010869
2014-02-04 11:12 frisch Note Added: 0010878
2014-02-04 11:13 frisch Note Edited: 0010878 View Revisions
2014-02-19 17:17 doligez Note Added: 0010953
2014-02-19 17:17 doligez Note Edited: 0010953 View Revisions

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker