2012/8/22 Yasuo Ohgaki :
> Hi,
>
> 2012/8/22 Peter Cowburn :
>> On 21 August 2012 23:26, Yasuo Ohgaki wrote:
>>> array_walk is the best(fast and memory efficient) way
>>> to delete elements.
>>
>> If array_walk() is the best (fast and memory efficient) way to delete
>> elements, why have we had th
2012/8/22 Levi Morrison :
>> Why did you change the equivalent code?
>> array_walk is the best(fast and memory efficient) way
>> to delete elements.
>>
>> This code may be refereed from old PHP users, therefore
>> we should write better code.
>>
>> If you don' t have good reason to do so, please re
Hi,
2012/8/22 Peter Cowburn :
> On 21 August 2012 23:26, Yasuo Ohgaki wrote:
>> array_walk is the best(fast and memory efficient) way
>> to delete elements.
>
> If array_walk() is the best (fast and memory efficient) way to delete
> elements, why have we had the following line in the manual, for
On 21 August 2012 23:26, Yasuo Ohgaki wrote:
> array_walk is the best(fast and memory efficient) way
> to delete elements.
If array_walk() is the best (fast and memory efficient) way to delete
elements, why have we had the following line in the manual, for the
array_walk() callback, for over a de
> Why did you change the equivalent code?
> array_walk is the best(fast and memory efficient) way
> to delete elements.
>
> This code may be refereed from old PHP users, therefore
> we should write better code.
>
> If you don' t have good reason to do so, please revert
> the change.
The implementa
Hi,
2012/8/22 Levi Morrison :
> On Tue, Aug 21, 2012 at 4:13 PM, Yasuo Ohgaki wrote:
>> Hi,
>>
>> I see why with new Criticism section in the wiki page.
>> You've also misunderstood that array_udelete() is
>> array_walk() variant, not array_filter().
>>
>
> Actually, array_udelete is far more sim
Hi,
2012/8/22 Levi Morrison :
> On Tue, Aug 21, 2012 at 4:13 PM, Yasuo Ohgaki wrote:
>> Hi,
>>
>> I see why with new Criticism section in the wiki page.
>> You've also misunderstood that array_udelete() is
>> array_walk() variant, not array_filter().
>>
>
> Actually, array_udelete is far more sim
On Tue, Aug 21, 2012 at 4:13 PM, Yasuo Ohgaki wrote:
> Hi,
>
> I see why with new Criticism section in the wiki page.
> You've also misunderstood that array_udelete() is
> array_walk() variant, not array_filter().
>
Actually, array_udelete is far more similar to array_filter than it is
array_walk
Hi,
I see why with new Criticism section in the wiki page.
You've also misunderstood that array_udelete() is
array_walk() variant, not array_filter().
This may be the good reason why we should have
array_udelete :)
Regards,
--
Yasuo Ohgaki
yohg...@ohgaki.net
2012/8/22 Yasuo Ohgaki :
> 2012/8/
2012/8/22 Levi Morrison :
> On Tue, Aug 21, 2012 at 3:45 PM, Andrew Faulds wrote:
>> On 21/08/12 22:43, Levi Morrison wrote:
>>>
>>> There is a reason to have a callable provided: custom comparison.
>>> Other array functions solve this by providing a `u` alternative:
>>>
>>> `int array_udelete(&$a
On Tue, Aug 21, 2012 at 3:45 PM, Andrew Faulds wrote:
> On 21/08/12 22:43, Levi Morrison wrote:
>>
>> There is a reason to have a callable provided: custom comparison.
>> Other array functions solve this by providing a `u` alternative:
>>
>> `int array_udelete(&$array, $value, bool function($value
Hi,
2012/8/22 Levi Morrison :
> There is a reason to have a callable provided: custom comparison.
> Other array functions solve this by providing a `u` alternative:
>
> `int array_udelete(&$array, $value, bool function($value, $key))`
>
> Let's not deviate from established array naming conventions
On 21/08/12 22:43, Levi Morrison wrote:
There is a reason to have a callable provided: custom comparison.
Other array functions solve this by providing a `u` alternative:
`int array_udelete(&$array, $value, bool function($value, $key))`
Let's not deviate from established array naming convention
There is a reason to have a callable provided: custom comparison.
Other array functions solve this by providing a `u` alternative:
`int array_udelete(&$array, $value, bool function($value, $key))`
Let's not deviate from established array naming conventions. (Yasuo,
I'm looking at you)
Cheers,
On 21/08/12 22:35, Yasuo Ohgaki wrote:
2012/8/22 Andrew Faulds :
On 21/08/12 22:18, Yasuo Ohgaki wrote:
2012/8/22 Andrew Faulds :
Er, so you're advocating adding another method to do the same thing? Why?
Because novices don't know about array_walk().
I think I've written this over and over in
2012/8/22 Andrew Faulds :
> On 21/08/12 22:18, Yasuo Ohgaki wrote:
>>
>> 2012/8/22 Andrew Faulds :
>>>
>>> Er, so you're advocating adding another method to do the same thing? Why?
>>
>> Because novices don't know about array_walk().
>> I think I've written this over and over in this thread.
>
> So
On 21/08/12 22:18, Yasuo Ohgaki wrote:
2012/8/22 Andrew Faulds :
Er, so you're advocating adding another method to do the same thing? Why?
Because novices don't know about array_walk().
I think I've written this over and over in this thread.
So publicise array_walk() then. Don't add a new func
2012/8/22 Andrew Faulds :
> Er, so you're advocating adding another method to do the same thing? Why?
Because novices don't know about array_walk().
I think I've written this over and over in this thread.
> The whole point of this was to allow people to use arrays like sets, or
> easily remove li
On 21/08/12 21:32, Yasuo Ohgaki wrote:
2012/8/22 Andrew Faulds :
On 21/08/12 21:00, Yasuo Ohgaki wrote:
Hi
2012/8/22 Andrew Faulds :
On 21/08/12 10:36, Yasuo Ohgaki wrote:
Int would be better and callable should be accepted like array_walk().
It's better to have array_delete_recursive(), too
2012/8/22 Andrew Faulds :
> On 21/08/12 21:00, Yasuo Ohgaki wrote:
>>
>> Hi
>>
>> 2012/8/22 Andrew Faulds :
>>>
>>> On 21/08/12 10:36, Yasuo Ohgaki wrote:
Int would be better and callable should be accepted like array_walk().
It's better to have array_delete_recursive(), too.
I
On 21/08/12 21:00, Yasuo Ohgaki wrote:
Hi
2012/8/22 Andrew Faulds :
On 21/08/12 10:36, Yasuo Ohgaki wrote:
Int would be better and callable should be accepted like array_walk().
It's better to have array_delete_recursive(), too.
I updated the page.
Callable? What? This is to remove a single v
Hi
2012/8/22 Andrew Faulds :
> On 21/08/12 10:36, Yasuo Ohgaki wrote:
>>
>> Int would be better and callable should be accepted like array_walk().
>> It's better to have array_delete_recursive(), too.
>> I updated the page.
>
> Callable? What? This is to remove a single value, like a set. If you w
On 21/08/12 10:36, Yasuo Ohgaki wrote:
Hi
2012/8/21 Tjerk Anne Meesters :
On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote:
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 d
Hi
2012/8/22 Levi Morrison :
> On Tue, Aug 21, 2012 at 12:53 PM, Yasuo Ohgaki wrote:
>> 2012/8/21 Levi Morrison :
>>>
>>> I'm against this RFC, but if you are going to even try to add
>>> something, please keep it consistent! Don't modify `array_delete` to
>>> take a callable, instead make a diff
On Tue, Aug 21, 2012 at 12:53 PM, Yasuo Ohgaki wrote:
> 2012/8/21 Levi Morrison :
>>
>> I'm against this RFC, but if you are going to even try to add
>> something, please keep it consistent! Don't modify `array_delete` to
>> take a callable, instead make a different function `array_udelete` or
>>
Hi,
2012/8/21 Levi Morrison :
> On Tue, Aug 21, 2012 at 3:36 AM, Yasuo Ohgaki wrote:
>> Hi
>>
>> 2012/8/21 Tjerk Anne Meesters :
>>> On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote:
>>>
Thank you, but this isn't really anything like what I had in mind.
What I had in mind is
On Tue, Aug 21, 2012 at 3:36 AM, Yasuo Ohgaki wrote:
> Hi
>
> 2012/8/21 Tjerk Anne Meesters :
>> On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote:
>>
>>> 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.
Hi
2012/8/21 Tjerk Anne Meesters :
> On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote:
>
>> 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.
>>
>>
On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote:
> 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 t
On Mon, Aug 20, 2012 at 8:47 PM, Levi Morrison wrote:
> On Mon, Aug 20, 2012 at 8:31 PM, Rasmus Schultz wrote:
>> 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 value
On Mon, Aug 20, 2012 at 8:31 PM, Rasmus Schultz wrote:
> 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
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/32
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 tak
I have a login (mindplay) but I do not have permission to post or edit
anything on the wiki...
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
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
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 d
Also, `array_splice` will remove the index while modifying the array in-place.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
On 20/08/12 19:05, Levi Morrison wrote:
Some major points to consider for `array_delete`'s behavior:
1. Should items be compared with `==`, `===`, or custom comparison? If
we use `==` or `===` we'd probably add `array_udelete` to allow a
custom comparator.
array_delete($array, $value, $all=fals
Some major points to consider for `array_delete`'s behavior:
1. Should items be compared with `==`, `===`, or custom comparison? If
we use `==` or `===` we'd probably add `array_udelete` to allow a
custom comparator.
2. Should it stop when it encounters the first value that matches? If
it does, s
On 20/08/12 18:43, Sebastian Krebs wrote:
Am 20.08.2012 19:00, schrieb Andrew Faulds:
On 20/08/12 17:47, Herman Radtke wrote:
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
Am 20.08.2012 19:00, schrieb Andrew Faulds:
On 20/08/12 17:47, Herman Radtke wrote:
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
"intuitiv
On 20/08/12 18:27, Levi Morrison wrote:
You are basically asking to alias array_filter with "array_delete". That is
a very slippery slope. I think array_filter is a very obvious choice
to remove something from an array. The "filter" function/method is common
in functional languages (and functiona
> You are basically asking to alias array_filter with "array_delete". That is
> a very slippery slope. I think array_filter is a very obvious choice
> to remove something from an array. The "filter" function/method is common
> in functional languages (and functional frameworks like Underscore).
Th
On 20/08/12 18:11, Levi Morrison wrote:
Adding array_delete would allow you to use it like a set more
It's not a set and wasn't meant to be. If you want really bad set
behavior, feel free to use an array as one.
Arrays also aren't lists or associative arrays, strictly speaking.
And there is a
> Adding array_delete would allow you to use it like a set more
It's not a set and wasn't meant to be. If you want really bad set
behavior, feel free to use an array as one.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
On 20/08/12 17:47, Herman Radtke wrote:
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_de
>> 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,
Absolutely, you're right. I have a tendency to get dragged into those.
I apologize.
On Fri, Aug 17, 2012 at 5:50 PM, Nikita Popov wrote:
>
> Could we please stop these pseudo-arguments?
2012/8/20 Andrew Faulds :
> On 20/08/12 00:16, Yasuo Ohgaki wrote:
>>
>> 2012/8/20 Andrew Faulds :
>>>
>>> On 20/08/12 00:05, Yasuo Ohgaki wrote:
2012/8/20 Etienne Kneuss :
>
> On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki
> wrote:
>>
>> 2012/8/18 Rasmus Lerdorf :
>>
On 20/08/12 00:16, Yasuo Ohgaki wrote:
2012/8/20 Andrew Faulds :
On 20/08/12 00:05, Yasuo Ohgaki wrote:
2012/8/20 Etienne Kneuss :
On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki
wrote:
2012/8/18 Rasmus Lerdorf :
On 08/17/2012 05:21 PM, Rasmus Schultz wrote:
if(($key = array_search($del_val
2012/8/20 Andrew Faulds :
> On 20/08/12 00:05, Yasuo Ohgaki wrote:
>>
>> 2012/8/20 Etienne Kneuss :
>>>
>>> On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki
>>> wrote:
2012/8/18 Rasmus Lerdorf :
>
> On 08/17/2012 05:21 PM, Rasmus Schultz wrote:
>>>
>>> if(($key = array_sear
On 20/08/12 00:05, Yasuo Ohgaki wrote:
2012/8/20 Etienne Kneuss :
On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki wrote:
2012/8/18 Rasmus Lerdorf :
On 08/17/2012 05:21 PM, Rasmus Schultz wrote:
if(($key = array_search($del_val, $messages)) !== false) {
unset($messages[$key]);
}
Nothing
2012/8/20 Etienne Kneuss :
> On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki wrote:
>> 2012/8/18 Rasmus Lerdorf :
>>> On 08/17/2012 05:21 PM, Rasmus Schultz wrote:
>
> if(($key = array_search($del_val, $messages)) !== false) {
> unset($messages[$key]);
> }
>
> Nothing ho
On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki wrote:
> 2012/8/18 Rasmus Lerdorf :
>> On 08/17/2012 05:21 PM, Rasmus Schultz wrote:
if(($key = array_search($del_val, $messages)) !== false) {
unset($messages[$key]);
}
Nothing horrible here.
>>>
>>> I disagree
2012/8/18 Rasmus Lerdorf :
> On 08/17/2012 05:21 PM, Rasmus Schultz wrote:
>>>
>>> if(($key = array_search($del_val, $messages)) !== false) {
>>> unset($messages[$key]);
>>> }
>>>
>>> Nothing horrible here.
>>>
>>
>> I disagree - this is (or should be) a simple, atomic operation...
>> yet, you'
On 19/08/12 01:39, Morgan L. Owens wrote:
On 2012-08-19 10:25, Andrew Faulds wrote:
On 18/08/12 14:52, Morgan L. Owens wrote:
How simple is it? Does it:
1) Remove one occurrence of the element (presumably the first) or all?
2) Reindex the array (as someone else argued was necessary to make it
On 2012-08-19 10:25, Andrew Faulds wrote:
On 18/08/12 14:52, Morgan L. Owens wrote:
How simple is it? Does it:
1) Remove one occurrence of the element (presumably the first) or all?
2) Reindex the array (as someone else argued was necessary to make it
"properly indexed" afterwards) or not?
3) M
On 18/08/12 14:52, Morgan L. Owens wrote:
Rasmus Schultz wrote:
> I disagree - this is (or should be) a simple, atomic operation...
> yet, you've got a function-call, an intermediary variable, a boolean
> test, and an unset statement repeating the name of the array you're
> deleting from.
>
> Th
On 17/08/12 22:41, Rasmus Lerdorf wrote:
On 08/17/2012 05:35 PM, Rasmus Schultz wrote:
Most other languages have more than one collection-type... since PHP has
only the single, hybrid array-type which acts both as a hash and as an
array, something like this ought to be available.
I don't know w
On Fri, Aug 17, 2012 at 11:35 PM, Rasmus Schultz wrote:
> Most other languages have more than one collection-type... since PHP has
> only the single, hybrid array-type which acts both as a hash and as an
> array, something like this ought to be available.
>
> I don't know why everyone is so eager
On 08/17/2012 05:35 PM, Rasmus Schultz wrote:
> Most other languages have more than one collection-type... since PHP has
> only the single, hybrid array-type which acts both as a hash and as an
> array, something like this ought to be available.
>
> I don't know why everyone is so eager to jump up
Most other languages have more than one collection-type... since PHP has
only the single, hybrid array-type which acts both as a hash and as an
array, something like this ought to be available.
I don't know why everyone is so eager to jump up and argue against
something this simple, basic and usef
On 08/17/2012 05:21 PM, Rasmus Schultz wrote:
>>
>> if(($key = array_search($del_val, $messages)) !== false) {
>> unset($messages[$key]);
>> }
>>
>> Nothing horrible here.
>>
>
> I disagree - this is (or should be) a simple, atomic operation...
> yet, you've got a function-call, an intermediar
63 matches
Mail list logo