We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Original bug ID: 6279 Reporter: @dbuenzli Assigned to: @gasche Status: resolved (set by @alainfrisch on 2016-12-06T18:37:19Z) Resolution: fixed Priority: normal Severity: feature Version: 4.01.0 Target version: 4.03.1+dev Fixed in version: 4.04.0 Category: standard library
would 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
Thanks.
The text was updated successfully, but these errors were encountered:
Comment author: braibant
Also, in the same vein, I find myself writing a "of_list" function quite often
module MSet = struct module Make(E:Set.OrderedType) = struct include Set.Make(E) let of_list l = List.fold_right (add) l empty end end
I agree that this is a one-liner, but a frequent one...
Sorry, something went wrong.
Comment author: @alainfrisch
@braibant: Set.of_list has already been added to trunk (will be available in OCaml 4.02), with a somewhat optimized implementation. See #4986.
Comment author: @damiendoligez
May I remind everyone that the best place for such functions is "extended" libraries like Batteries and Jane Street Core?
Comment author: @gasche
I'm postponing this to 4.04, but I proposed a pull request at:
#553
gasche
No branches or pull requests
Original bug ID: 6279
Reporter: @dbuenzli
Assigned to: @gasche
Status: resolved (set by @alainfrisch on 2016-12-06T18:37:19Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 4.01.0
Target version: 4.03.1+dev
Fixed in version: 4.04.0
Category: standard library
Bug description
would 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
Thanks.
The text was updated successfully, but these errors were encountered: