bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can a and d be the same for asort?


From: Peng Yu
Subject: can a and d be the same for asort?
Date: Sun, 4 Jul 2021 09:12:23 -0500

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]