bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] Makes sort create random order


From: Paul Eggert
Subject: Re: [PATCH] Makes sort create random order
Date: Mon, 31 Jan 2005 11:37:21 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Frederik Eaton <address@hidden> writes:

> I've given many examples - can you give an example of a situation
> where people would put (a) differently-formatted numbers in a column
> of a file (how would they become differently-formatted?) and then sort
> randomly based on their values, (b) insisting that ties stay together?

No, but that's because I don't know what the phrase "sort randomly
based on their values" means.  If it's really a random process, it
will ignore their values; then it's not a sort at all.

> When you want to rearrange lines of a file, you turn to one command
> - sort.

No, it depends on what sort of rearrangement I want.  If I want to
reverse the file, for example, I'll use "tac".

> you might want to sort on one key and randomize on another

That can be done easily by combining "permute" and "sort", no?  You
permute the input, then use a stable sort on the key that you want to
sort by.

> none of the existing programs handle large files as well as 'sort'
> does.

"tac" does.

>> That's OK in many applications.  (You have 30 black balls and 20 white
>> balls in an urn, and want to select 7 balls without replacement....)
>
> OK, after some thought I agree with you. Do you think it would be too
> confusing to have both alternatives available?

It'd be nicer if we had just one alternative.  And it's pretty easy:
just do "sort -u | permute" if you want to avoid duplicates.

So I still don't see why this functionality should be part of "sort".




reply via email to

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