Re: How to delete few elements from array beginning?
От | Alexander Farber |
---|---|
Тема | Re: How to delete few elements from array beginning? |
Дата | |
Msg-id | CAADeyWhpTjqPJOqrcv2yXCBnHSTLA8V679Y2q5-RYi5fuA-UJg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: How to delete few elements from array beginning? (Chris Travers <chris.travers@gmail.com>) |
Ответы |
Re: How to delete few elements from array beginning?
|
Список | pgsql-general |
Hello Chris,
On Wed, Mar 9, 2016 at 4:42 PM, Chris Travers <chris.travers@gmail.com> wrote:
On Wed, Mar 9, 2016 at 1:10 PM, Alexander Farber <alexander.farber@gmail.com> wrote:or is there a better way?Do I really have to copy a large slice of the array to itself, like in the last line here:what is please the most efficient way to delete a slice from the start of a longer array (after I have copied it to another array)?
pile_array := pile_array || swap_array;
/* here I copy away swap_len elements */
new_hand := pile_array[1:swap_len];
/* here I don't know how to efficiently remove already copied elements */
pile_array := pile_array[(swap_len + 1):ARRAY_LENGTH(pile_array, 1)];This looks like something for card hands?What you are doing seems correct to me.
actually card hands would be easier - because cards are unique in the deck.
But here I have letter hands (like "AAABCDE") in a word game and they are not unique in the pile...
Regards
Alex
В списке pgsql-general по дате отправления: