Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-12 Thread Hassan Ahmed
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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-08 Thread Hassan Ahmed
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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-07 Thread Hendra Gunawan
> > 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(

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-07 Thread Larry Garfield
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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-07 Thread Hassan Ahmed
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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hendra Gunawan
> > 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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hendra Gunawan
> > 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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hendra Gunawan
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`

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Larry Garfield
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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hendra Gunawan
> > 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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hassan Ahmed
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.

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Mark Randall
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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Claude Pache
> 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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hassan Ahmed
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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-05 Thread Rowan Tommins
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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-05 Thread Mark Randall
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:

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-04 Thread Hendra Gunawan
> > 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

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-04 Thread Marco Pivetta
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

[PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-04 Thread Hassan Ahmed
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