<div dir="ltr">I don't love `extract`, myself. I can see the motivation - extracting something generally means removing it without destroying it. But I worry that that's not salient enough to make the meaning clear. I dunno, maybe it's just that Data.Map already has "update", "alter" and "adjust", and I have no idea which is which - I don't think extract would be as bad as those, but it feels like in the same direction.<div><br></div><div>For the Maybe version, I'd suggest `deleteLookup`. Or at least something with both those words, but this combination seems to be what I'd expect given the existing `splitLookup`, `deleteFindMin` and `deleteFindMax`. "delete" seems to be the standard "remove something from the map" - the word "remove" isn't yet used, so I don't see any reason to introduce it. And "lookup" seems to be the standard name for "look something up using Maybe in case it's not there". (By contrast, "find" seems to be the standard name for "look something up and error if it's not there".)</div><div><br></div><div>For the default version, the only existing function I can see that takes a default is `findWithDefault`. (And this is the only use of "find" in the name of a function that doesn't error.) `deleteFindWithDefault` is a handful, but it would still be my suggestion.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 6, 2020 at 5:30 PM Alexey Kuleshevich <<a href="mailto:alexey@kuleshevi.ch">alexey@kuleshevi.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>`extract` is the name that I would suggest. I also agree with David that `pop` is a bit too confusing in a non-stack/queue data structure. If all languages named it pop, then it would be good argument for the name, but we don't need to copy python. The only thing that pyhon has that I wish we had in Haskell is the popularity ;)<br></div><div> +1 on the function itself from me, I've needed it multiple occasions.<br></div><div><div><br></div><div><br></div></div><div><br></div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div> On Sunday, December 6, 2020 8:16 PM, Carter Schonwald <<a href="mailto:carter.schonwald@gmail.com" target="_blank">carter.schonwald@gmail.com</a>> wrote:<br></div><div> <br></div><blockquote type="cite"><div dir="auto">LookupThenRemove seems like a more descriptive name.  Though I guess I can see why pop has appeal. <br></div><div><div><br></div><div class="gmail_quote"><div dir="ltr">On Sun, Dec 6, 2020 at 11:44 AM David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">I suggest you add a version for Data.Sequence combining lookup with deleteAt. I wanted that for something fairly recently.<br></div><div><br></div><div class="gmail_quote"><div dir="ltr">On Sun, Dec 6, 2020, 11:41 AM Martijn Bastiaan via Libraries <<a href="mailto:libraries@haskell.org" target="_blank">libraries@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Yeah, Python's `pop` made me call it `pop`. I had hoped to find other <br></div><div> examples, but Java, Rust, and Ruby don't seem to offer `pop`-like <br></div><div> functions for their (hash)maps.<br></div><div> <br></div><div> On 12/6/20 5:29 PM, Tom Ellis wrote:<br></div><div> > On Sun, Dec 06, 2020 at 11:25:33AM -0500, David Feuer wrote:<br></div><div> >> The name pop makes me think of a stack. Is this use of the word common?<br></div><div> > Python uses that name, which is why I'm familiar with it:<br></div><div> ><br></div><div> >>>> d = {'a': 1, 'b': 2}<br></div><div> >>>> d.pop('b')<br></div><div> > 2<br></div><div> >>>> d<br></div><div> > {'a': 1}<br></div><div> > _______________________________________________<br></div><div> > Libraries mailing list<br></div><div> > <a href="mailto:Libraries@haskell.org" rel="noreferrer" target="_blank">Libraries@haskell.org</a><br></div><div> > <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br></div><div> _______________________________________________<br></div><div> Libraries mailing list<br></div><div> <a href="mailto:Libraries@haskell.org" rel="noreferrer" target="_blank">Libraries@haskell.org</a><br></div><div> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br></div></blockquote></div><div>_______________________________________________<br></div><div> Libraries mailing list<br></div><div> <a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br></div><div> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br></div></blockquote></div></div></blockquote><div><br></div>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>