[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mon, 26 Oct 2009 09:20:11 -0500
so the default (undocumented) behavior is that for(i in a) processes i
in sorted order?
i'm puzzled by that. i remember Kerningham saying they had that in awk
1.0 then pulled it our cause it made everything too slow. aharon- did
you come up with some neat incremental sorting trick?
On Mon, Oct 26, 2009 at 5:26 AM, Hermann Peifer <address@hidden> wrote:
> Aharon Robbins wrote:
>> It's what programmer types call an "easter egg", meaning an undocumented
>> feature with unusual or interesting behavior, and I intend to keep it
>> that way (but see the gawk.texi file :-).
>> The feature as coded means "if WHINY_USERS exists in the environment,
>> enable the whiny user related features." (There are at least two.)
>> So, the behavior you're seeing is what I wanted. I don't intend to
>> change it.
>> Personally, I think you should use asort or asorti if you want array
>> sorting. The code is much clearer that way.
> Thanks for the explanations, which confirms my observation that
> WHINY_USERS=0 isn't enough to unset the variable.
> About asort() and asorti(): I use these functions occasionally, but what I
> actually need most are simply sorted *original* array indices (which almost
> always have some meaning, like country code, or similar, so I don't want to
> destroy them). IMO, there is nothing better and cleaner than WHINY_USERS to
> achieve this gawk behaviour. The built-in asorti() function forces me to
> copy src array into dest array in order to avoid the loss of original
> indices. This makes the code more complicated, as I see it.
> Anyway: I actually didn't want to start a discussion here. Thanks again for
> the WHINY_USERS easter egg!.
> PS for Tim: You might want to re-visit your WHINY_USERS performance test
> described in http://awk.info/?tip/whinyUsers
there are those who call me... (dr) timm (menzies)?
morgantown (39.6n, -79w), usa
assoc prof csee, wvu
'Hydrogen is a light, odorless gas, which, given enough time, turns
Re: WHINY_USERS=0, Aharon Robbins, 2009/10/30