-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add nondeterminstic map delete
and insertIfAbsent
#124
Comments
insert
for SLMap that silently ignores subsequent write attempts.insertIfAbsent
for SLMap that silently ignores subsequent write attempts.
The `Data.LVar.SLMap.insert` function throws the runtime error if multiple insertion attempts at the same key index is attempted. This commits adds `insertIfAbsent`, which silently ignores subsequent insertion attempts after a first successful attempt for a given key. Relates to iu-parfunc#124 .
I've pushed a commit for Is this a sensible addition to the SLMap module? If so, I'd happily submit a pull request. If not, I'd be interested in knowing why. Thanks! |
Thanks! Yes, this is sensible, but the type has to be right. This is a nondeterministic effect. Thus in addition to Note this will mean that any computation containing this operation can be only be done with a |
@DreamLinuxer - can Ctrie implement this easily or not? |
Ditto for delete operations. |
insertIfAbsent
for SLMap that silently ignores subsequent write attempts.delete
and insertIfAbsent
The Data.LVar.SLMap.insert function throws the runtime error "Multiple puts to one entry in an IMap!" if a 2nd insertion for the same key is attempted.
Is there a fundamental objection to an additional
insertIfAbsent
in SLMap with different semantics, namely that the 1st value written to a key entry succeeds, subsequent attempts to the same key are silently ignored? With the same type, i.e.This is the implementation of the underlying
putIfAbsent_
used byputIfAbsent
:It looks like the
putIfAbsent
in the skip list map module simply ignores subsequent write attempts to a key entry, returningFound v
if a value already exists. Could this be lifted into the SLMap API as an alternative insertion functioninsertIfAbsent
in the way I describe?Not sure who subscribes to GitHub issues for the lvars repo, cc @osa1 @rrnewton .
The text was updated successfully, but these errors were encountered: