Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62330 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23413 invoked from network); 21 Aug 2012 02:31:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2012 02:31:29 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.212.42 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:35671] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/A6-28202-FF2F2305 for ; Mon, 20 Aug 2012 22:31:28 -0400 Received: by vbbfs19 with SMTP id fs19so6867503vbb.29 for ; Mon, 20 Aug 2012 19:31:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=7qgLbTqy0xn5xQY9dsMOCGPCiLT8jZP+PIYX5AUm9F8=; b=ktwHpvF3rzpBjU9KuXQIZxdqL0k3Ib06rvsvYHpO+OuFPLrLEsPxOBXO1glOXjRxg4 5gzbFp4Yu2q6ZT7M0Er1YSujI0k/B7jF8rxMb54E8tmZu2CzNLJbLS+fRgIQUsYQw2Gl b7xvByUK6BTChys5kK4ttLYUJEub/SZDq6kd0TPs3JY3d6quqa1K0k/kgUAck4dPayPo E83ZjV65TMEnbWJ7W2A2W16wla7kcjrTVz/nWRVIZ2fQeER2VjYP7i7uAw1vas8sCknh MCYyVsm0iDIKQ0bR3N5KdgZfB47mo1T9xMzZrCGZrRPJqc3jTNv/PsEnWbVX48h+/2WP 5PqQ== MIME-Version: 1.0 Received: by 10.220.209.80 with SMTP id gf16mr9903567vcb.58.1345516279730; Mon, 20 Aug 2012 19:31:19 -0700 (PDT) Received: by 10.220.24.3 with HTTP; Mon, 20 Aug 2012 19:31:19 -0700 (PDT) In-Reply-To: References: <502EB667.1020602@lerdorf.com> Date: Mon, 20 Aug 2012 22:31:19 -0400 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=bcaec54ee282e4911c04c7bd6b31 X-Gm-Message-State: ALoCoQnzMijy8Y9WK5X/fXfOF3v5okFoepC4prQWSGyICrzWXtDeClYd3zdQqtZ3MTa7vAHyqH1x Subject: Re: [PHP-DEV] re: removing an item from an array From: rasmus@mindplay.dk (Rasmus Schultz) --bcaec54ee282e4911c04c7bd6b31 Content-Type: text/plain; charset=ISO-8859-1 Thank you, but this isn't really anything like what I had in mind. What I had in mind is more like set-semantics for arrays, e.g. designed to work with sets of distinct values/objects. Since I do not have permission to write on the wiki, I posted an initial draft here: https://gist.github.com/321ad9b4b8c4e1713488 On Mon, Aug 20, 2012 at 10:10 PM, Yasuo Ohgaki wrote: > Hi, > > 2012/8/21 Rasmus Schultz : > > I have a login (mindplay) but I do not have permission to post or edit > > anything on the wiki... > > I've created RFC for this > > https://wiki.php.net/rfc/array_delete > > Get wiki account and finish discussion. > I may write patch for this with my spare time, but > it may take while to find time. I suggest write patch > and send pull request. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > > > > On Mon, Aug 20, 2012 at 8:01 PM, Will Fitch wrote: > > > >> Please let this die until someone is serious enough to come up with an > >> rfc. This has been nothing but counterproductive arguing. If someone > feels > >> strongly about it, write an rfc then we can discuss? > >> On Aug 20, 2012 7:53 PM, "Yasuo Ohgaki" wrote: > >> > >>> Hi, > >>> > >>> 2012/8/21 Herman Radtke : > >>> >>> May be we should have something like > >>> >> > >>> >> >> > >>> >> >> array_delete_if($array, function($v, $k=null) { if ($v == 300) > >>> return > >>> >> >> true; }) > >>> >> > > >>> >> > So array_filter? > >>> >> > >>> >> I'll use it or like for deleting, but the point of this thread is > >>> >> "intuitive function for deleting element(s)" > >>> >> > >>> >> array_delete($array, $value|callable) > >>> >> > >>> >> would be nicer for users, perhaps. > >>> > > >>> > > >>> > You are basically asking to alias array_filter with "array_delete". > >>> That is > >>> > a very slippery slope. I think array_filter is very a very obvious > >>> choice to > >>> > remove something from an array. The "filter" function/method is > common > >>> in > >>> > functional languages (and functional frameworks like Underscore). > >>> > > >>> > These are things developers just need to learn as part of > development. > >>> > Really, this is entire thread should be on stack overflow, not > >>> internals. > >>> > >>> I guess you haven't read later post. > >>> > >>> You've also made a novice mistake. > >>> array_filter() DO NOT delete elements, but creates new array. > >>> array_delete() is another form of array_walk(), not array_filter(). > >>> See my posts. > >>> > >>> Having a API for dedicated task is good thing. > >>> Who would argue array_pop()/array_push() isn't needed? > >>> > >>> Regards, > >>> > >>> -- > >>> Yasuo Ohgaki > >>> yohgaki@ohgaki.net > >>> > >>> -- > >>> PHP Internals - PHP Runtime Development Mailing List > >>> To unsubscribe, visit: http://www.php.net/unsub.php > >>> > >>> > --bcaec54ee282e4911c04c7bd6b31--