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

Jan Schenkel janschenkel at yahoo.com
Thu Jan 9 01:11:54 EST 2014


Addiing only an 'into' clauset would indeed be a bit silly - my plan was to transplant another 'filter' feature: the ability to sort an expression.
This would allow you to write:

sort theFirstList & return & theSecondList into theSortedList

Of course, you could still write that in two lines, with little performance penalty.
But a future version of the engine could optimise the one-liner by parallelising the operations…

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 Wed, 1/8/14, Peter Haworth <pete at lcsql.com> wrote:

 Subject: Re: There should be a "unique" option on sort . . .
 To: "How to use LiveCode" <use-livecode at lists.runrev.com>
 Date: Wednesday, January 8, 2014, 3:24 PM
 
 I think that would be useful Jan, but
 it's pretty easy to put the unsorted
 container into a different container then sort it so I'm not
 sure it's
 worth your time and effort.
 Pete
 
 Pete
 lcSQL Software <http://www.lcsql.com>
 
 
 On Wed, Jan 8, 2014 at 1:52 PM, Jan Schenkel <janschenkel at yahoo.com>
 wrote:
 
 > 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
 >
 >
 > _______________________________________________
 > use-livecode mailing list
 > use-livecode at lists.runrev.com
 > Please visit this url to subscribe, unsubscribe and
 manage your
 > subscription preferences:
 > http://lists.runrev.com/mailman/listinfo/use-livecode
 _______________________________________________
 use-livecode mailing list
 use-livecode at lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage
 your subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 




More information about the use-livecode mailing list