I already added a new function `array_group`, any further
comments/thoughts will be highly appreciated.
Regards,
~Hassan
On Wed, Dec 8, 2021 at 11:35 AM Hassan Ahmed <7sno...@gmail.com> wrote:
>
> Hendra Gunawan IMHO your suggestions is not related to
> `array_group()`, you are talking about a gr
Hendra Gunawan IMHO your suggestions is not related to
`array_group()`, you are talking about a great change in PHP as
mentioned by Larry, since we can have `Array($input, group(),
reducer(), mapper(), filter() . and so forth);` or even any other
way to handle the list comprehensions. but for a
>
> And if you want to map, reduce, or filter without grouping? Then you can't
> really use this function. And as noted, the order in which you apply those
> operations may matter, and no order is necessarily more obvious or beneficial
You can modify it slightly if you eager to:
array_group(
On Tue, Dec 7, 2021, at 3:42 AM, Hassan Ahmed wrote:
> This is a great suggestion Hendra, I really believe that it may take
> the new function to another level, but - with Larry's comment in mind
> - this is a language design more than function design. Supporting the
> list/array comprehensions wil
This is a great suggestion Hendra, I really believe that it may take
the new function to another level, but - with Larry's comment in mind
- this is a language design more than function design. Supporting the
list/array comprehensions will be a great step for PHP, as I can
remember that Nikita alre
>
> Better map/filter/reduce primitives in PHP would be dandy, but they have
> nothing to do with array grouping. They're a separate operation that should
> be composed with grouping. Packing them all into a single function sounds
> like a terrible idea.
>
> If we wanted that... that's called list
>
> Better map/filter/reduce primitives in PHP would be dandy, but they have
> nothing to do with array grouping. They're a separate operation that should
> be composed with grouping. Packing them all into a single function sounds
> like a terrible idea.
>
> If we wanted that... that's called list
Revision to my recommendation are:
1. signature:
array_group(
array|object $array,
int|string|array $index_key,
callable $reducer = null,
callable $mapper = null,
callable $filter = null,
callable $sorter = null,
): array
2. `sorter` should
On Mon, Dec 6, 2021, at 4:16 PM, Hendra Gunawan wrote:
>>
>> Hello Folks, Thanks a lot for your feedback, as already mentioned in
>> the RFC and as mentioned by Rowan too a new function is an option. I
>> think that mostly we will go with the new function option.
>> I will try to edit the PR to add
>
> Hello Folks, Thanks a lot for your feedback, as already mentioned in
> the RFC and as mentioned by Rowan too a new function is an option. I
> think that mostly we will go with the new function option.
> I will try to edit the PR to add a new function, does there any
> suggestions/naming convent
The named arguments are a great thing to set in mind, but I think that
we will go to complicate it with optional arguments.
there is a comment on the PR that asks for another option to preserve
the sub-array index to be the new array index. also with the comments
by `Hendra Gunawan` in mind. adding
On 05/12/2021 14:02, Rowan Tommins wrote:
Since this is explicitly an open question in the current RFC draft, it
seems a bit premature to talk about voting, rather than encouraging the
RFC to develop in a particular direction.
I hope it was taken as nothing more than an indication that adding
> Le 6 déc. 2021 à 09:44, Hassan Ahmed <7sno...@gmail.com> a écrit :
>
> Hello Folks, Thanks a lot for your feedback, as already mentioned in
> the RFC and as mentioned by Rowan too a new function is an option. I
> think that mostly we will go with the new function option.
> I will try to edit t
Hello Folks, Thanks a lot for your feedback, as already mentioned in
the RFC and as mentioned by Rowan too a new function is an option. I
think that mostly we will go with the new function option.
I will try to edit the PR to add a new function, does there any
suggestions/naming conventions for the
On 05/12/2021 10:41, Mark Randall wrote:
On 04/12/2021 14:21, Marco Pivetta wrote:
Gonna vote `no` on this: please design new/dedicated functions,
rather than
expanding optional parameters.
I would vote no for the same reason.
Since this is explicitly an open question in the current RFC d
On 04/12/2021 14:21, Marco Pivetta wrote:
Gonna vote `no` on this: please design new/dedicated functions, rather than
expanding optional parameters.
I would vote no for the same reason.
Mark Randall
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.ph
>
> Hello, this is a proposal to upgrade the functionality of
> `array_column` to return an indexed array for all of the matched data
> instead of a single result.
>
> the RFC had been created here
> https://wiki.php.net/rfc/array_column_results_grouping and the PR is
> in here https://github.com/p
Gonna vote `no` on this: please design new/dedicated functions, rather than
expanding optional parameters.
On Sat, 4 Dec 2021, 10:57 Hassan Ahmed, <7sno...@gmail.com> wrote:
> Hello, this is a proposal to upgrade the functionality of
> `array_column` to return an indexed array for all of the matc
Hello, this is a proposal to upgrade the functionality of
`array_column` to return an indexed array for all of the matched data
instead of a single result.
the RFC had been created here
https://wiki.php.net/rfc/array_column_results_grouping and the PR is
in here https://github.com/php/php-src/pull
19 matches
Mail list logo