[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: can a and d be the same for asort?
From: |
Andrew J. Schorr |
Subject: |
Re: can a and d be the same for asort? |
Date: |
Sun, 4 Jul 2021 13:24:02 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
It's OK, but why is it useful and worth documenting?
What's the benefit of supplying a 2nd argument equal
to the 1st argument?
On Sun, Jul 04, 2021 at 09:12:23AM -0500, Peng Yu wrote:
> Hi,
>
> https://www.gnu.org/software/gawk/manual/html_node/Array-Sorting-Functions.html
>
> It is not clear whether it is OK to make s and d be the same array.
> Should they never be the same in order for asort to work? If so,
> should this be clearly stated? If not, it should also be mentioned to
> make it clear.
>
> asort(s [, d [, how] ]) Return the number of elements in the
> source array s. Sort the contents of s using gawk's normal rules for
> comparing values, and
> replace the indices of the sorted
> values s with sequential integers starting with 1. If the optional
> destination array d is speci-
> fied, first duplicate s into d, and
> then sort d, leaving the indices of the source array s unchanged. The
> optional string how con-
> trols the direction and the comparison
> mode. Valid values for how are any of the strings valid for
> PROCINFO["sorted_in"]. It can
> also be the name of a user-defined
> comparison function as described in PROCINFO["sorted_in"].
>
> --
> Regards,
> Peng
- can a and d be the same for asort?, Peng Yu, 2021/07/04
- Re: can a and d be the same for asort?,
Andrew J. Schorr <=
- Re: can a and d be the same for asort?, Andrew J. Schorr, 2021/07/05
- Re: can a and d be the same for asort?, Neil R. Ormos, 2021/07/05
- Re: can a and d be the same for asort?, Andrew J. Schorr, 2021/07/05
- Re: can a and d be the same for asort?, Wolfgang Laun, 2021/07/05
Re: can a and d be the same for asort?, arnold, 2021/07/06