On Dec 31, 2005, at 11:11 AM, Phil M wrote:
Isn't that a great function? It removes and returns the last element
in an array.
Well I am a little bothered that the equivalent function was not
created to remove and return the first item of the array. PHP calls
this function array_shift() but I don't think that name describes the
function well enough... what other names can you think of that would
describe a Pop function for the first element in the array?
Really depends on what you image the array is being treated as
In the case of Pop it's like a stack (so maybe Array.Push should be the
same as array.append ?)
And, it really doesn't matter that the element is the first r last IF
it's a stack as long as you are consistent with usage.
If what you want is a way to add one to "the front" and remove one from
"the end" then the terms are for what's known as a queue ; Enqueue -
adds to "the front" and Dequeue removes "from the end"
So, in this case maybe array.append is "Enqueue"
And array.remove 0 is "Dequeue"
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|