There should be a "unique" option on sort . . .

Jan Schenkel janschenkel at yahoo.com
Wed Jan 8 16:52:16 EST 2014


Hi Mark et al,

The 'sort' command should return the same content, not throw out chunks, that might be better as an extension to the 'filter' command.
But your comment about how sort affects the original container made me wonder.

So I took another look at the source for the 'sort' command in cmds.cpp, and it doesn't look that hard to add an 'into' clause.
Putting the sorted data into another container is straightforward to add to MCSort::exec (done that for the 'filter' command).
The hardest part is untangling the MCSort::parse spaghetti.

If I find the time I might take a stab at it…

Cheers,

Jan Schenkel.

=====
Quartam Reports & PDF Library for LiveCode
www.quartam.com

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

--------------------------------------------
On Sat, 1/4/14, Mark Wieder <mwieder at ahsoftware.net> wrote:

 Subject: Re: There should be a "unique" option on sort . . .
 To: "How to use LiveCode" <use-livecode at lists.runrev.com>
 Date: Saturday, January 4, 2014, 5:02 PM
 
 > yes, or to only take the first
 that matches the sort key if sorting by
 > other than the full record.
 
 I can see it being slightly useful in certain cases, but it
 leaves me
 feeling a bit queasy. I think it's unsettling enough that
 the sort
 command sorts in place instead of being a function that
 returns a
 sorted copy, and of course it's way too late to change that
 now. So
 deleting items from a dataset while sorting them seems one
 more step
 down that ladder. I do realize that you'd have to specify
 "unique"
 explicitly, but still... if it didn't mess with the original
 data set
 I'd be all over this.
 
 -- 
 -Mark Wieder
  ahsoftware at gmail.com
 




More information about the use-livecode mailing list