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

Comments

Projects
None yet
1 participant
@vicuna
Copy link

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Author

commented Feb 20, 2017

Comment author: @alainfrisch

#1026

@vicuna vicuna closed this Feb 28, 2017

@vicuna vicuna added the stdlib label Mar 14, 2019

@vicuna vicuna added the feature-wish label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.