Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111733 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14933 invoked from network); 31 Aug 2020 00:50:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Aug 2020 00:50:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B28151804D8 for ; Sun, 30 Aug 2020 16:54:54 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 30 Aug 2020 16:54:54 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 413D25DB for ; Sun, 30 Aug 2020 19:54:52 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Sun, 30 Aug 2020 19:54:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=pOqLoD CadmS8AAtEvV6Di2nIQGqKEC+mQcFLCyJoYjI=; b=ZLpTxYFHCjM4vVPhtejj4b KEPrVlHn3E4IDG0ImBMRZyK2FqvQH0o4B2/ylUCIvDL/zlqDeMJBKNZRORXA7u+N mulRryIxRn+Sl/pqwBjKFlSWuTwhtbqngxpEwlIay5SvC3lPmVLaflvrvSMekuO4 y+JIwX7V9g1cvzUSkDJneakPs9XP3qGOrROy75qQgRGU64N5PyXO72eKc9TX1wT/ ng2kZ7hn7zoUHiOieUx+MhkbhvDLX5vPkdJLFixlgIvBel/9oIhyhfwzar0dXGCw oc1qjhDUtmuIsvA/t7sRdMcoVO2CaZ5jzHgkt0w6ayKNIkWPbMy2l7Bu8qVlal1Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudefgedgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 0057C14200A2; Sun, 30 Aug 2020 19:54:50 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-232-g4bdb081-fm-20200825.002-g4bdb081a Mime-Version: 1.0 Message-ID: <3e1a9076-ddb0-498e-8c13-242b87ec62c9@www.fastmail.com> In-Reply-To: References: Date: Sun, 30 Aug 2020 18:54:30 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] array_reject() as counterpart of array_filter() From: larry@garfieldtech.com ("Larry Garfield") On Sun, Aug 30, 2020, at 9:38 AM, David Rodrigues wrote: > Currently we have array_filter(), but sometimes we need an inverse function > like array_reject(). > > array_reject('is_null', [ 1, 2, null, 3 ]); // [ 1, 2, 3 ] > > It could be easily implemented with: > > function array_reverse($fn, $arr) { return array_filter(fn($item) => > !$fn($item), $arr); } > > Anyway, I think that It should be implemented by core, once that we have > array_filter(). Any boolean function can be inverted with a simple ! in a short closure. I don't really see a need to do that in C. --Larry Garfield