Skip to content
New issue

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

provides a update function for map #7309

Closed
vicuna opened this issue Jul 29, 2016 · 3 comments
Closed

provides a update function for map #7309

vicuna opened this issue Jul 29, 2016 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Jul 29, 2016

Original bug ID: 7309
Reporter: @bobzhang
Status: resolved (set by @alainfrisch on 2017-02-28T13:15:59Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: standard library
Has duplicate: #8223
Related to: #5220
Monitored by: "Boris Yakokobowski"

Bug description

type would be

val update: key -> ('a option -> 'a) -> 'a t -> 'a t

the rational is mostly for performance, this API is also available in Haskell

https://downloads.haskell.org/~ghc/6.12.3/docs/html/libraries/containers-0.3.0.0/Data-Map.html#6

@vicuna
Copy link
Author

vicuna commented Jul 31, 2016

Comment author: @alainfrisch

I'd be interested to see benchmarks to illustrate the gains. Avoiding an extra (allocation-free) lookup could be somehow compensated by the extra allocations for the closure and the option type. Or could flambda get rid of them?

@vicuna
Copy link
Author

vicuna commented Aug 1, 2016

Comment author: @bobzhang

note that exception is not cheap in JS backend, while update is a quite common paradigm,
I am in favor of having a update function which does not rely on exception, but it is still a good step that we have a update function whether it relies on exception or not

@vicuna
Copy link
Author

vicuna commented Feb 20, 2017

Comment author: @alainfrisch

#1026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant