Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92991 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33793 invoked from network); 30 Apr 2016 15:56:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2016 15:56:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.84 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.84 mx103.easyname.com Received: from [77.244.243.84] ([77.244.243.84:35368] helo=mx202.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/8B-58459-0A5D4275 for ; Sat, 30 Apr 2016 11:56:16 -0400 Received: from cable-81-173-133-226.netcologne.de ([81.173.133.226] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1awXFd-0001xK-8t; Sat, 30 Apr 2016 15:56:13 +0000 Reply-To: internals@lists.php.net References: <8ea990da-1fe7-256c-4e08-0b30715c8e8a@gmail.com> <5724C9A7.5080504@fleshgrinder.com> <5724D490.6070500@fleshgrinder.com> To: Marco Pivetta , PHP Internals List Message-ID: <5724D58E.4040907@fleshgrinder.com> Date: Sat, 30 Apr 2016 17:55:58 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <5724D490.6070500@fleshgrinder.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LOdfePLvJsLS5CqQaHGkDFhq8XvNEC4nV" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC] Pipe Operator From: php@fleshgrinder.com (Fleshgrinder) --LOdfePLvJsLS5CqQaHGkDFhq8XvNEC4nV Content-Type: multipart/mixed; boundary="Bc6fa4Wgx5RpteDETuuISh7GoDoXwhDPl" From: Fleshgrinder Reply-To: internals@lists.php.net To: Marco Pivetta , PHP Internals List Message-ID: <5724D58E.4040907@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC] Pipe Operator References: <8ea990da-1fe7-256c-4e08-0b30715c8e8a@gmail.com> <5724C9A7.5080504@fleshgrinder.com> <5724D490.6070500@fleshgrinder.com> In-Reply-To: <5724D490.6070500@fleshgrinder.com> --Bc6fa4Wgx5RpteDETuuISh7GoDoXwhDPl Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/30/2016 5:51 PM, Fleshgrinder wrote: > $ret =3D scandir($arg) > |> array_filter($$, function($x) { return $x !=3D=3D '.' && $x !=3D '= =2E.'; }) > |> array_map(function ($x) use ($arg) { return $arg . '/' . $x; }, $$= ) > |> getFileArg($$) > |> array_merge($ret, $$); This should actually be formatted as to be fair contender to the procedural example: $ret =3D scandir($arg) |> array_filter($$, function ($x) { return $x !=3D=3D '.' && $x !=3D=3D '..'; }) }> array_map(function ($x) use ($arg) { return $arg . '/' . $x; }, $$) |> getFileArg($$) |> array_merge($ret, $$); Not a big difference now... $files =3D scandir($arg); $files =3D array_filter($files, function ($x) { return $x !=3D=3D '.' && $x !=3D=3D '..'; }); $files =3D array_map(function ($x) use ($arg) { return $path . '/' . $x; }, $files); $ret =3D array_merge($ret, getFileArg($files)); =2E..the only thing that bugs me in the procedural code is the fact that array_filter and array_map take their arguments in different order. :P --=20 Richard "Fleshgrinder" Fussenegger --Bc6fa4Wgx5RpteDETuuISh7GoDoXwhDPl-- --LOdfePLvJsLS5CqQaHGkDFhq8XvNEC4nV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXJNWPAAoJEOKkKcqFPVVrEmgP/3VFdEsMCmUmrNSrggE2I2+j ZK+aV+rI/jgiVGCATyLYG15cyERIaTerHVaA5O3DZfpiB+awyJub6f9QCJRAdjj5 egKaTp9RBkGcSiigbW25ms0QyHP2gvGeXPzi72Da+Xt6X2BM4LSY7k74klQGQLTR 3YZWmjFKlK5pVjBUEtx8a/fYwLSoEGLgc88usAcxis9bTftstkZCrNkFvcS48BvX gh1RbqnDVc2WDEU6J1tj8ae73rDs5+uRxrkLHbgtCoAKuetDIPld52vusDizKqTF ZPPuM/JalAro6wKcXqJC7wfJi1TiJkLgnESKF/RsSd9Gak4kXB7dTunVljj/htyd vEDg3eaHHUJ1ZKmqoeBk/mRbnozKipa0lzMwmXyaNut/ww3gcZtoaeXOgZw32fc2 WZ745JX3YTBFsPPN+jNnfCsA0c6U6lzMTCW1BViaBWpfT444q8SPjKfjtNvMNdxb PIKVVaPhJqh6pX9Jid0oVNJRIJ9ZbFPEU+SpBTcOgBO+tkChoXCDt8cH+9Af4A6J rxSiK02jsHJ1NqPQ4ub+fH/TBbLj1fBYIfmrhSYWhJQPwdtCvR5+u+j9wWe/Oi+S HN8qvGSX8cnQ9KlA7dslUYn49dfzugccJrU4z6taI/SqdH3dNVw3MQkS7MUHeAvY 6Ygy8S22+WG/Cv28cyjw =rS5M -----END PGP SIGNATURE----- --LOdfePLvJsLS5CqQaHGkDFhq8XvNEC4nV--