[plt-dev] remf in unstable/list

From: Eli Barzilay (eli at barzilay.org)
Date: Thu May 27 14:47:36 EDT 2010

On May 27, David Van Horn wrote:
> On 5/27/10 2:27 PM, Eli Barzilay wrote:
> > On May 26, Sam Tobin-Hochstadt wrote:
> >> On Wed, May 26, 2010 at 3:54 PM, Eli Barzilay<eli at barzilay.org>  wrote:
> >>> On May 25, David Van Horn wrote:
> >>>> Could the following make its way into unstable/list?  It adds
> >>>> remf for symmetry with findf and memf.
> >>>
> >>> Is there any reason for putting it in unstable?  It should not be
> >>> used outside of the racket tree.
> >>
> >> I agree - I can't imagine that the interface to `remf' is likely to
> >> change.
> >
> > I missed the fact that this is removing only the first matching item
> > rather than all of them (which would make it the same as
> > `filter-not').  Are there any cases where this is useful?
> 
> Here's a patch that reverts adding remf to unstable and another that
> adds it to racket/list.

(There's no reason to have it as two separate patches...)


> I think remf is useful since it is an abstraction of remove, remv,
> remq, etc., and including it is consistent with findf, memf, and
> assf.

IMO, `findf', `memf', and `assf' are expected to return only the
first, but `remf' isn't.  Practically all of my interaction with the
`mem...' functions had two problems: (a) surprising me with the fact
that the non-*ed versions remove only the first, (b) annoying me with
lumping the remove-all functionality with a list-of-values input,
which in almost all cases makes me end up with a (remv* (list x) l).

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the dev mailing list.