Re: How to get the difference between two lists?

2005-04-05 Thread Wouter
On 05 Apr 2005, at 20:03, Dar Scott wrote:
snip
// filter version
function shortListDar5 pL, pEx
  filter pL without replaceText(pEx,"\n","|")
  return pL
end shortListDar5
Dar

This was the reason I was lamenting that  rev's filter "command" is not 
fully regex compatible.
Your replaceText part returns a "|" delimited list. But the  "|" (or)  
does not work in the filter command.
Not as in filter x without "5|6|11|18" nor as in filter  x without 
"[56]|1[18]".
The  "|" seems even to be ignored between [ ] brackets.

Gr W.
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-05 Thread Dar Scott
On Apr 5, 2005, at 11:12 AM, Wouter wrote:
Could you compile a oneliner regex that worked in rev's filter 
function?
Not one that worked.  Only the replaceText() worked and then for 
smaller lists.

This is what I tried:
// replaceText version
function shortListDar3 pL, pEx
  return replaceText(pL,"(?m)^" & replaceText(pEx,"\n","\n|^") & 
"\n",empty)
end shortListDar3

// filter version
function shortListDar5 pL, pEx
  filter pL without replaceText(pEx,"\n","|")
  return pL
end shortListDar5
Dar
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-05 Thread Wouter
Could you compile a oneliner regex that worked in rev's filter function?
completely amazed,
W.
On 05 Apr 2005, at 18:58, Dar Scott wrote:
On Apr 5, 2005, at 7:40 AM, Wouter wrote:
It would have been nice if the "filter" function was fully regex 
compatible then Dar's idea of turning it into a regex statement could 
produce something like a one-liner.

I tried it and it was a oneliner.
It was awfully slow.  It took six seconds (IIRC) for a thousand and 
couldn't compile the regex for 10,000.

There have been several times when I tried using the replaceText() 
function and was surprised at how slow it was.  I may be thinking 
about it wrong.

Dar
--
**
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming Services and Software
**
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-05 Thread Dar Scott
On Apr 5, 2005, at 7:40 AM, Wouter wrote:
It would have been nice if the "filter" function was fully regex 
compatible then Dar's idea of turning it into a regex statement could 
produce something like a one-liner.

I tried it and it was a oneliner.
It was awfully slow.  It took six seconds (IIRC) for a thousand and 
couldn't compile the regex for 10,000.

There have been several times when I tried using the replaceText() 
function and was surprised at how slow it was.  I may be thinking about 
it wrong.

Dar
--
**
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming Services and Software
**
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-05 Thread Wouter
On 04 Apr 2005, at 05:44, Dar Scott wrote:
On Apr 3, 2005, at 9:04 PM, Ken Ray wrote:
I can of course do a repeat loop through the small list and remove 
those
items from the comprehensive list, but I'm wondering if there's a 
faster way
to do this.
Some wild ideas:
1.  Convert the smaller list into a regex and use replaceText().
snip
It would have been nice if the "filter" function was fully regex 
compatible then Dar's idea of turning it into a regex statement could 
produce something like a one-liner.

For the proposed example with the current state of the filter function 
it needs 2 lines (not counting the lines for the preparation of the 
regex)3

filter tOrigList without  "[56]"
filter tOrigList without  "1[18]"
Gr W.
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Dar Scott
On Apr 3, 2005, at 9:04 PM, Ken Ray wrote:
I can of course do a repeat loop through the small list and remove 
those
items from the comprehensive list, but I'm wondering if there's a 
faster way
to do this.
I took a break and tried my hand at this.
The function using offset did better than array element deletion in 
some cases.  The function using replaceText() did poorly for medium 
size lists and bailed out for large lists to be removed.  I think there 
is something fishy (that is n^2) in replaceText().  The last one was my 
attempt to avoid 'line n' and is similar to Frank's, I think.  It was 
still a little bit slower than array element deletion in my tests.

function shortListDar2 pList, pExcludeList
  local resultList = ""
  put lf before pList
  put 0 into lastUsedChar
  if char -1 of pList is not lf then put lf after pList
  repeat for each line ex in pExcludeList
put lf & ex & lf into exWithLF
get offset(exWithLf,pList,lastUsedChar)
if it is not zero then
  put char lastUsedChar+1 to lastUsedChar+it of pList after 
resultList
  put lastUsedChar + it + length(exWithLF) - 1 into lastUsedChar
end if
  end repeat
  put char lastUsedChar+1 to -1 of pList after resultList
  return char 2 to -2 of resultList
end shortListDar2

--function shortListDar3 pList, pExcludeList
--  get "(?m)^" & replaceText(pExcludeList,"\n","\n|^") & "\n"
--  return replaceText(pList,it,empty)
--end shortListDar3
function shortListDar4 pList, pExcludeList
  local resultList
  put lf & "10" after pExcludeList
  put line 1 of pExcludeList into checkLine
  put 1 into charOffset
  repeat for each line listLine in pList
repeat while checkLine < listLine
  add length(checkLine)+1 to charOffset
  put line 1 of (char charoffset to charoffset+20 of pExcludeList) 
into checkLine
end repeat
if listLine < checkline then
  put listLine & lf after resultList
end if
  end repeat
  return char 1 to -2 of resultList
end shortListDar4
--
**
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming Services and Software
**

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Frank D. Engel, Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
put sourceArray into sectArray
intersect sectArray with exceptArray
repeat for each line k in the keys of sectArray
  delete variable sourceArray[k]
end repeat
On Apr 4, 2005, at 5:46 PM, David Vaughan wrote:
On 05/04/2005, at 0:38, Ken Ray <[EMAIL PROTECTED]> wrote:
On 4/4/05 1:39 AM, "Monte Goulding" <[EMAIL PROTECTED]> 
wrote:

Ken (and all the other ingenious people), you have something 
against the
"intersect" command?

Convert both lists to arrays and intersect them leaving only the
non-common elements.
My understanding is the intersect command creates an array with only 
common
keys. If there was an inverse of the command it would be perfect as 
you say.
I added this as an enhancement request to Bugzilla (Bug #2763 if 
anyone
wants to vote on it).
I'll vote for it Ken. While I am at it I might vote that I do not 
reverse-read documentation as well ;-)

cheers
David
Ken Ray
Sons of Thunder Software
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

- ---
Frank D. Engel, Jr.  <[EMAIL PROTECTED]>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCUbhe7aqtWrR9cZoRAnLrAKCIW7F2FUuw1nlySpVd5IOdRF0C7ACgiWdm
yl4goDLYuppb5TVh7V72aX0=
=JJJw
-END PGP SIGNATURE-

___
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread David Vaughan
On 05/04/2005, at 0:38, Ken Ray <[EMAIL PROTECTED]> wrote:
On 4/4/05 1:39 AM, "Monte Goulding" <[EMAIL PROTECTED]> 
wrote:

Ken (and all the other ingenious people), you have something against 
the
"intersect" command?

Convert both lists to arrays and intersect them leaving only the
non-common elements.
My understanding is the intersect command creates an array with only 
common
keys. If there was an inverse of the command it would be perfect as 
you say.
I added this as an enhancement request to Bugzilla (Bug #2763 if anyone
wants to vote on it).
I'll vote for it Ken. While I am at it I might vote that I do not 
reverse-read documentation as well ;-)

cheers
David
Ken Ray
Sons of Thunder Software
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Trevor DeVore
On Apr 4, 2005, at 1:50 PM, Frank D. Engel, Jr. wrote:
If the DB is properly indexed, there is no way that Transcript should 
be able to perform that kind of sort faster than the DB server.  An 
SQL server should be able to use an index to perform that kind of sort 
substantially faster than it could be done by a generic sorting 
algorithm, such as what Rev would need to use with its 'sort' command.
That was my thought as well which is why I wanted to clarify the 
statement.

The only major exception is when the client is distributed among 
multiple computers (different people accessing the server 
simultaneously with the client on separate machines per user) and the 
database server is on hardware which is being very heavily used.  In 
this case, the client may be able to sort the incoming data faster 
than the DB can, only due to the server being slowed down by a heavy 
processing load of multiple other users.  However, there would need to 
be a rather extreme number of users for a correctly indexed database 
to slow down to this point, at least with a query like that one, since 
the index should allow the server to just read off the needed data in 
a sorted order to begin with, rather than needing to take any extra 
steps to sort it at all.  Complex views might complicate the matter 
somewhat, but last time I checked, MySQL did not support views (a 
somewhat strange omission for such a popular db server...)
Views were just barely added with the 5.0 release.
--
Trevor DeVore
Blue Mango Multimedia
[EMAIL PROTECTED]
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Brian Yennie
I'm sure all of this is application specific, but generally speaking if 
you are pulling data from MySQL and _then_ sorting it in Transcript 
faster than in-database, there is probably something non-optimal about 
the database schema or queries. Generally speaking, when I'm working on 
a web application that needs to handle a lot of hits, it's a huge red 
flag if I have to post-sort anything out of the database. That's not to 
say Rev can't take the wheel and do a pretty good job (kudos to Rev), 
but I can't remember an instance where I couldn't make more of an 
impact working on the database side of things.

With that said, if it's a factor of needing to do _other_ things in Rev 
at the same time, programming efficiency, etc- then it's a perfectly 
fine solution.

I would be shocked to find that Rev is better optimized for sorting 
than MySQL in any general sense. I'm wondering if it's worth pulling 
out any more specifics that someone can share about their table 
structures, queries, etc?

Please note I don't mean that sorting should literally be offloaded 
back to the database- but that there is almost always a fast way to get 
it that way in the first place, especially if we're just dealing with 
recID lookups and sorts.

- Brian
I've been heavily using Rev cgi and mySQL during the past
few months, and I found out that extracting raw data from the
db and processing them (sorting, comparing...) in Transcript
is most of the time much faster than writing sophisticated
SQL code...
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread jbv

Oh, 1 thing I forgot :
I didn't find the syntax for the SQL equivalent of Transcript
"sort international"

JB

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread jbv
I must confess that I'm much more fluent in Transcript than in
SQL, so productivity-wise, I feel more confortable writing
complex transcript than complex SQL...
Nevertheless I'm working on a project involving a table with
23,000 entries (so far) and 35 fields in each (total weight 5Mb)
that makes heavy use of indexes. I have SQL requests involving
at least 5 to 7 fields, that extract 12 to 20 flds, and on which I
perform successive sorts.

for instance :
SELECT A, B, C, D, E, F, G FROM myTable WHERE A>10 AND B>A AND H>G
etc...

the selection can reach 1000 to 1500 lines

and then :
sort lines of myRequest ascending international by item 6 of each
sort lines of myRequest ascending numeric by item 5 of each
sort lines of myRequest ascending numeric by item 4 of each
sort lines of myRequest ascending international by item 2 of each
etc

and then further processing, like grouping lines in which item 1
contains similar values to be displayed in different tables in a
HTML page and / or comparing values of item 6 of each line with
a set of values already stored in a field of another table, etc.

then build (rather complex) HTML pages by reading template
txt files and replacing certain kew words with HTML code build
in the same script around data from the db...
---

I didn't perform any speed test, but the general feeling is that cgi
requests are performed significantly faster when most sorting /
processing is done in Transcript than in SQL...

I also have a client web app (made with Rev) that accesses the
same db / server, and the feeling is the same...

JB

> Do you mean that the transcript sorting code executes faster than the
> mySQL doing the sorting (with something like 'SELECT ID, FirstName,
> LastName FROM people ORDER BY LastName') or that it is just easier for
> you to handle everything in transcript rather than figuring out the SQL
> syntax to perform some of the sorts, joins, etc.?

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Frank D. Engel, Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
If the DB is properly indexed, there is no way that Transcript should 
be able to perform that kind of sort faster than the DB server.  An SQL 
server should be able to use an index to perform that kind of sort 
substantially faster than it could be done by a generic sorting 
algorithm, such as what Rev would need to use with its 'sort' command.

The only major exception is when the client is distributed among 
multiple computers (different people accessing the server 
simultaneously with the client on separate machines per user) and the 
database server is on hardware which is being very heavily used.  In 
this case, the client may be able to sort the incoming data faster than 
the DB can, only due to the server being slowed down by a heavy 
processing load of multiple other users.  However, there would need to 
be a rather extreme number of users for a correctly indexed database to 
slow down to this point, at least with a query like that one, since the 
index should allow the server to just read off the needed data in a 
sorted order to begin with, rather than needing to take any extra steps 
to sort it at all.  Complex views might complicate the matter somewhat, 
but last time I checked, MySQL did not support views (a somewhat 
strange omission for such a popular db server...)

On Apr 4, 2005, at 4:40 PM, Trevor DeVore wrote:
Do you mean that the transcript sorting code executes faster than the 
mySQL doing the sorting (with something like 'SELECT ID, FirstName, 
LastName FROM people ORDER BY LastName') or that it is just easier for 
you to handle everything in transcript rather than figuring out the 
SQL syntax to perform some of the sorts, joins, etc.?

- ---
Frank D. Engel, Jr.  <[EMAIL PROTECTED]>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCUaiE7aqtWrR9cZoRAmPVAKCRLmyw301tHZCVzVhcMaM+uICS3gCfV2x7
uYM3tgGMtRwDDHAQvizbhmc=
=sJMT
-END PGP SIGNATURE-

___
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Trevor DeVore
On Apr 4, 2005, at 1:11 PM, jbv wrote:
well, I don't know...
I've been heavily using Rev cgi and mySQL during the past
few months, and I found out that extracting raw data from the
db and processing them (sorting, comparing...) in Transcript
is most of the time much faster than writing sophisticated
SQL code...
Do you mean that the transcript sorting code executes faster than the 
mySQL doing the sorting (with something like 'SELECT ID, FirstName, 
LastName FROM people ORDER BY LastName') or that it is just easier for 
you to handle everything in transcript rather than figuring out the SQL 
syntax to perform some of the sorts, joins, etc.?

--
Trevor DeVore
Blue Mango Multimedia
[EMAIL PROTECTED]
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Frank D. Engel, Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
That depends on how you write the queries, how busy the server is, how 
much information needs to be shuttled between the client and the 
server, and various other factors.

Also, an ad hoc query against an SQL server needs to be parse, planned, 
and executed by the server each time it is sent.  A complex query may 
be better handled as a stored procedure, so that it can be pre-planned; 
this will cut down on execution time later on.  If you are dealing with 
a large amount of information, processing it on the server may cut down 
on time spent transmitting info across a slower network which will 
later be eliminated anyway.  Additionally, depending on the operations 
being performed, the server may be able to take advantage of indexes, 
etc. that the client will not have access to.

Now as far as using the SQL server to maintain lists, if you can store 
each entry as a separate row in a table, for example (based on 
PostgreSQL and untested; may or may not be the most efficient queries 
in some cases):

CREATE TABLE myLists
(
listID INTEGER NOT NULL,
listValue TEXT
);
CREATE INDEX ndxMyLists ON myLists (listID, listValue);

Now to retrieve a list in sorted order by value:
SELECT listValue FROM myLists WHERE (listID = 1) ORDER BY listValue;
To perform an intersection operation between two lists:
SELECT DISTINCT listValue FROM myLists WHERE (listID = 1) AND 
(listValue IN (SELECT listValue FROM myLists WHERE (listID = 2

To perform a union operation between two lists:
(SELECT listValue FROM myLists WHERE (listID = 1)) UNION (SELECT 
listValue FROM myLists WHERE (listID = 2))

**or**
SELECT DISTINCT listValue FROM myLists WHERE ((listID = 1) OR (listID = 
2))

To perform a set difference:
SELECT listValue FROM myLists WHERE (listID = 1) AND NOT (listValue IN 
(SELECT listValue FROM myLists WHERE (listID = 2)))

Note that this set difference is only different from my suggestion for 
intersection by a single NOT operator...

I missed the original post, what else did you need to be able to do?
BTW, one of the issues with using mySQL like this is its lack of 
support for stored procedures, or have they added this capability yet?  
Even pure SQL stored procedures would be fine for most of this stuff...

On Apr 4, 2005, at 4:11 PM, jbv wrote:
I like this one, Ken.  In general, I'd reconsider the overall design.
Specifically, I'd think about queries that do what you want.  If the
set has to be a single value, then I'd consider a blob that represents
a bit set as the db representation.
well, I don't know...
I've been heavily using Rev cgi and mySQL during the past
few months, and I found out that extracting raw data from the
db and processing them (sorting, comparing...) in Transcript
is most of the time much faster than writing sophisticated
SQL code...
JB
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

- ---
Frank D. Engel, Jr.  <[EMAIL PROTECTED]>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCUaYR7aqtWrR9cZoRAviWAJ9SzSDGdg3JJNPdmCoOka8RVk7otwCfdB1I
5YwzbHHISddnuNB20nd3fR4=
=FSMG
-END PGP SIGNATURE-

___
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Dar Scott
On Apr 4, 2005, at 2:11 PM, jbv wrote:
I've been heavily using Rev cgi and mySQL during the past
few months, and I found out that extracting raw data from the
db and processing them (sorting, comparing...) in Transcript
is most of the time much faster than writing sophisticated
SQL code...
I bow to your experience.
In that case, I'd look for a way to keep sets in the db in a form that 
is handy for their use.  If use is primarily set operations, I'd look 
toward optimizing that, and choosing the representation for that 
optimization.  I think that leaves out an array as representation.

Dar
--
**
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming Services and Software
**
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread jbv
>
> I like this one, Ken.  In general, I'd reconsider the overall design.
> Specifically, I'd think about queries that do what you want.  If the
> set has to be a single value, then I'd consider a blob that represents
> a bit set as the db representation.
>

well, I don't know...
I've been heavily using Rev cgi and mySQL during the past
few months, and I found out that extracting raw data from the
db and processing them (sorting, comparing...) in Transcript
is most of the time much faster than writing sophisticated
SQL code...
JB

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Dar Scott
On Apr 4, 2005, at 12:07 AM, Brian Yennie wrote:
What kind of database? You might be able to keep these operations 
in-database, depending on what the tables/ needs are.
I like this one, Ken.  In general, I'd reconsider the overall design.  
Specifically, I'd think about queries that do what you want.  If the 
set has to be a single value, then I'd consider a blob that represents 
a bit set as the db representation.

Dar
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Alex Tweedly
Frank D. Engel, Jr. wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Interesting.  Note that it would not be difficult to modify that code 
to support lists which do not meet those criteria (as long as both 
lists are still sorted, or else you'd need to sort them first), but I 
already lost the old stats: is this 15ms faster. or slower?
It's not "faster" or "slower". The earlier comparison compared two 
functions - "Shortlist" and "difference". "difference" is the code that 
uses arrays and delete variable - i.e. the second of the suggested 
methods from Dar, and also suggested by Monte.

Combining the previous stats and the new one, (i.e. extrapolating and 
guessing) you get something like
old Shortlist : 300
new code (and variants) : 200 + / - a bit
difference : 15

i.e. all the methods that loop through making use of the fact that the 
data in each list is sorted are significantly faster than using "among 
the lines of", but much slower than using the arrays.

Given the problems with that one, I'm curious: how does something like 
this compare (this version only requires that both lists are in 
ascending numeric order):

looks like just another variant - I'm guessing it will be 200ms give or 
take a bit, and don't feel the need to know exactly how much plus or 
minus; the array method is clearly the one to use.

--
Alex Tweedly   http://www.tweedly.net

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.6 - Release Date: 30/03/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Frank D. Engel, Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Interesting.  Note that it would not be difficult to modify that code 
to support lists which do not meet those criteria (as long as both 
lists are still sorted, or else you'd need to sort them first), but I 
already lost the old stats: is this 15ms faster. or slower?

Given the problems with that one, I'm curious: how does something like 
this compare (this version only requires that both lists are in 
ascending numeric order):

put empty into the targetList
put 1 into x
put the number of lines in the masterList into maxX
put line 1 of the masterList into y
repeat for each line z in the exceptList
  repeat while (y < z) and (x <= maxX)
put (y & cr) after the targetList
add 1 to x
put line x of the masterList into y
  end repeat
  repeat while (y = z) and (x <= maxX)
add 1 to x
put line x of the masterList into y
  end repeat
end repeat
repeat with x = x to maxX
  put (line x of the masterList) & cr after the targetList
end repeat
delete the last char of the targetList
On Apr 4, 2005, at 1:27 PM, Alex Tweedly wrote:
Frank D. Engel, Jr. wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Okay, so anyone want to report on this one (untested, but should be 
rather efficient):

This algorithm assumes that every item in the exclusion list is 
included in the master list, that there are no duplicate items in 
either list, and that both lists are in ascending numeric order:
That assumption isn't met by the earlier test data - so I can't do an 
exact comparison with the earlier cases.

But with 10,000 in the full list, and 1,667 in the smaller list 
(instead of 5000), the times are
new code: 183 ms
difference: 15 ms

Surprising - I expected it to be faster, but I tried a few variants 
and they all had much the same timings.

--
Alex Tweedly   http://www.tweedly.net

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.6 - Release Date: 30/03/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

- ---
Frank D. Engel, Jr.  <[EMAIL PROTECTED]>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCUX327aqtWrR9cZoRApgRAJ96CZkw6IseDfnRyeV5nsVa3d8SGQCfYQ23
CSOK7Y1hy9S50fKTpxl7klk=
=Nil+
-END PGP SIGNATURE-

___
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Alex Tweedly
Frank D. Engel, Jr. wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Okay, so anyone want to report on this one (untested, but should be 
rather efficient):

This algorithm assumes that every item in the exclusion list is 
included in the master list, that there are no duplicate items in 
either list, and that both lists are in ascending numeric order:
That assumption isn't met by the earlier test data - so I can't do an 
exact comparison with the earlier cases.

But with 10,000 in the full list, and 1,667 in the smaller list (instead 
of 5000), the times are
new code: 183 ms
difference: 15 ms

Surprising - I expected it to be faster, but I tried a few variants and 
they all had much the same timings.

--
Alex Tweedly   http://www.tweedly.net

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.6 - Release Date: 30/03/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Frank D. Engel, Jr.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Okay, so anyone want to report on this one (untested, but should be 
rather efficient):

This algorithm assumes that every item in the exclusion list is 
included in the master list, that there are no duplicate items in 
either list, and that both lists are in ascending numeric order:

put empty into targetList
put (excludeList & cr & 10) into eCopy  -- use some 
absurdly huge
-- number, guaranteed to not be in either list, and to be 
larger than the largest possible
-- number in either list
put 1 into z
repeat for each line x in masterList
  if x < (line z of eCopy) then put (x & cr) after targetList
  else add 1 to z
end repeat
delete the last char of targetList

On Apr 4, 2005, at 10:27 AM, Jim Hurley wrote:
Message: 6
Date: Sun, 03 Apr 2005 22:04:54 -0500
From: Ken Ray <[EMAIL PROTECTED]>
Subject: How to get the difference between two lists?
To: Use Revolution List 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;   charset="US-ASCII"
I've got two lists - one with is the "comprehensive" list that is
return-delimited, like:
(snip)

Ken,
I wrote a short stack (non-pancake) a short time ago to deal with the 
multitude of e-mail list among the various volunteer groups in my 
community, extract duplicates, find common lines, etc.

It will generate the both the intersection and the union of any two 
lists. Don't know if this is any help but you can see with

  go url "http://home.infostations.net/jhurley/CompareLists.rev";
Jim
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

- ---
Frank D. Engel, Jr.  <[EMAIL PROTECTED]>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCUVvQ7aqtWrR9cZoRAh7pAJ0ajDgAWnoR/007yYs3bio03xk8lQCfQhzo
FxOsMhZvTLt2NQF9ixuKDfk=
=1IIo
-END PGP SIGNATURE-

___
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Ken Ray
On 4/4/05 9:27 AM, "Jim Hurley" <[EMAIL PROTECTED]> wrote:

> I wrote a short stack (non-pancake) a short time ago to deal with the
> multitude of e-mail list among the various volunteer groups in my
> community, extract duplicates, find common lines, etc.
> 
> It will generate the both the intersection and the union of any two
> lists. Don't know if this is any help but you can see with
> 
>go url "http://home.infostations.net/jhurley/CompareLists.rev";

Very cool, Jim, thanks!


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Jim Hurley
Message: 6
Date: Sun, 03 Apr 2005 22:04:54 -0500
From: Ken Ray <[EMAIL PROTECTED]>
Subject: How to get the difference between two lists?
To: Use Revolution List 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;   charset="US-ASCII"
I've got two lists - one with is the "comprehensive" list that is
return-delimited, like:
(snip)

Ken,
I wrote a short stack (non-pancake) a short time ago to deal with the 
multitude of e-mail list among the various volunteer groups in my 
community, extract duplicates, find common lines, etc.

It will generate the both the intersection and the union of any two 
lists. Don't know if this is any help but you can see with

  go url "http://home.infostations.net/jhurley/CompareLists.rev";
Jim
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Thomas McGrath III
Richard had shared that some time ago and it worked great, the thing is 
for some reason (SuperCard, I guess) I have a hard time putting my mind 
around repeat for each line tLine and then if tLine - I have used it  
but it doesn't always come to mind in trying to figure something out.

Love it though.
tom
On Apr 3, 2005, at 11:49 PM, Richard Gaskin wrote:
function ShortList pList, pExcludelist
  repeat for each line tLine in pList
if tLine is not among the lines of pExcludeList then
  put tLine & cr after tNulist
end if
  end repeat
  delete last char of tNuList
  return tNuList
end ShortList
Thomas J. McGrath III
SCS
1000 Killarney Dr.
Pittsburgh, PA 15234
412-885-8541
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Ken Ray
On 4/4/05 1:39 AM, "Monte Goulding" <[EMAIL PROTECTED]> wrote:

>> Ken (and all the other ingenious people), you have something against the
>> "intersect" command?
>> 
>> Convert both lists to arrays and intersect them leaving only the
>> non-common elements.
> 
> My understanding is the intersect command creates an array with only common
> keys. If there was an inverse of the command it would be perfect as you say.

I added this as an enhancement request to Bugzilla (Bug #2763 if anyone
wants to vote on it).

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-04 Thread Richard Gaskin
Dick Kriesel wrote:
On 4/3/05 7:49 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote:
With 10,000 lines in my main list and 5,000 lines in my exclude list, it
takes only 25 milliseconds to use this on my single-processor PBG4 1MHz:
function ShortList pList, pExcludelist
  repeat for each line tLine in pList
if tLine is not among the lines of pExcludeList then
  put tLine & cr after tNulist
end if
  end repeat
  delete last char of tNuList
  return tNuList
end ShortList

Wow, that's fast.  So I decided to compare it to an implementation of Dar's
second suggestion, which I've been using for a long time. The test I tried
yields times very different from Richard's.  Even though my machine is a
dual 2 GHz G5, function "Shortlist" took almost a hundred times longer than
Richard reported.  I wonder why the times are so different.
But the other function ran almost 70 times faster than function "Shortlist."
Indeed it did. My earlier test was bunk -- can I use jet lag as my 
excuse today?  :)

Here's the latest test below -- the array version is indeed orders of 
magnitude faster.

But one note from Ken raises a question -- Ken wrote:
Unfortunately this is something that will be executed in a
loop several thousand times, so even at 25ms * 2000 that
ends up being 50 seconds, which is way too long.
You've probably already consider this, but is there a way you can reduce 
the number of iterations?


on mouseUp
  repeat with i = 1 to 1
put i&cr after tList
  end repeat
  put xList(tList) into tExcludeList
  --
  put the millisecs into t
  get ShortList1(tList, tExcludeList)
  put the millisecs - t into t1
  --
  put the millisecs into t
  get ShortList2(tList,tExcludeList)
  put the millisecs - t into t2
  --
  put t1 && t2
end mouseUp
function ShortList1 pList, pExcludelist
  repeat for each line tLine in pList
if tLine is not among the lines of pExcludeList then
  put tLine & cr after tNulist
end if
  end repeat
  delete last char of tNuList
  return tNuList
end ShortList1
function ShortList2 pList, pExcludelist
  split pList with return and tab
  repeat for each line tLine in pExcludelist
delete variable pList[tLine]
  end repeat
  return the keys of pList
end ShortList2
function xList pList
  repeat for each line tLine in pList
if tLine mod 2 = 0 then
  put tLine & cr after tNulist
end if
  end repeat
  delete last char of tNuList
  return tNuList
end xList
--
 Richard Gaskin
 Fourth World Media Corporation
 ___
 [EMAIL PROTECTED]   http://www.FourthWorld.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Ken Ray
On 4/4/05 1:33 AM, "David Vaughan" <[EMAIL PROTECTED]> wrote:

> Ken (and all the other ingenious people), you have something against
> the "intersect" command?

Yes - what I need is the *opposite* of intersect... you see using intersect
only returns the *common* elements, not the *non-common* elements.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Ken Ray
On 4/4/05 2:31 AM, "Dick Kriesel" <[EMAIL PROTECTED]> wrote:

>> With 10,000 lines in my main list and 5,000 lines in my exclude list, it
>> takes only 25 milliseconds to use this on my single-processor PBG4 1MHz:
> 
> Wow, that's fast.  So I decided to compare it to an implementation of Dar's
> second suggestion, which I've been using for a long time. The test I tried
> yields times very different from Richard's.  Even though my machine is a
> dual 2 GHz G5, function "Shortlist" took almost a hundred times longer than
> Richard reported.  I wonder why the times are so different.

Mine ran that slowly as well... perhaps Richard's doing something we aren't?

> But the other function ran almost 70 times faster than function "Shortlist."

That's awesome, Dick... I didn't get a chance to benchmark it so I'll use
that instead.


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Monte Goulding
Ken (and all the other ingenious people), you have something against the 
"intersect" command?

Convert both lists to arrays and intersect them leaving only the 
non-common elements.
My understanding is the intersect command creates an array with only common 
keys. If there was an inverse of the command it would be perfect as you say.

Cheers
Monte 

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread David Vaughan
On 04/04/2005, at 16:34, Ken Ray <[EMAIL PROTECTED]> wrote:
I've got two lists - one with is the "comprehensive" list that is
return-delimited, like:
3
5
6

And another list which is the list I would like to *remove* from the
comprehensive list:
5
6

Which should give me:
3

Any ideas?
Ken (and all the other ingenious people), you have something against 
the "intersect" command?

Convert both lists to arrays and intersect them leaving only the 
non-common elements.

cheers
David
Ken Ray
Sons of Thunder Software
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Dick Kriesel
On 4/3/05 7:49 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote:
> 
> With 10,000 lines in my main list and 5,000 lines in my exclude list, it
> takes only 25 milliseconds to use this on my single-processor PBG4 1MHz:
> 
> 
> function ShortList pList, pExcludelist
>repeat for each line tLine in pList
>  if tLine is not among the lines of pExcludeList then
>put tLine & cr after tNulist
>  end if
>end repeat
>delete last char of tNuList
>return tNuList
> end ShortList

Wow, that's fast.  So I decided to compare it to an implementation of Dar's
second suggestion, which I've been using for a long time. The test I tried
yields times very different from Richard's.  Even though my machine is a
dual 2 GHz G5, function "Shortlist" took almost a hundred times longer than
Richard reported.  I wonder why the times are so different.

But the other function ran almost 70 times faster than function "Shortlist."

Here are the other function, the "test" handler, and the test results:

function difference pList1,pList2
  split pList1 with return and tab
  repeat for each line tLine in pList2
delete variable pList1[tLine]
  end repeat
  return the keys of pList1
end difference
-
on test
  repeat with i = 3 to 3 step 3 -- 1 multiples of 3
put i & cr after tBig
  end repeat
  delete last char of tBig
  put "number of lines in tBig:" && number of lines in tBig & cr
  
  repeat with i = 2 to 1 step 2 -- 5000 multiples of 2
put i & cr after tLittle
  end repeat
  delete last char of tLittle
  put "number of lines in tLittle:" && number of lines in tLittle \
  & cr after msg
  
  put the milliseconds into tBefore
  put shortList(tBig,tLittle) into tDiff1
  put the milliseconds into tAfter
  put "elapsed milliseconds for Shortlist:" && (tAfter - tBefore) \
  & cr after msg
  
  put the milliseconds into tBefore
  put difference(tBig,tLittle) into tDiff2
  put the milliseconds into tAfter
  put "elapsed milliseconds for difference:" && (tAfter - tBefore) \
  & cr after msg
  
  sort tDiff2 numeric
  put "matching results:" && (tDiff1 = tDiff2) & cr after msg
end test
-
number of lines in tBig: 1
number of lines in tLittle: 5000
elapsed milliseconds for Shortlist: 2423
elapsed milliseconds for difference: 35
matching results: true






___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Brian Yennie
Ken,
What kind of database? You might be able to keep these operations 
in-database, depending on what the tables/ needs are.

For example:
SELECT recID FROM someTable WHERE (recID IN (3,5,6,7,11,14,18,21)) AND 
NOT (recID IN (5,6,11,18))

It's a little kludgey using the above, but keeping the work in-database 
somewhere might give you good results.
The database delete of course could be something like:

DELETE FROM someTable WHERE recID IN (5,6,11,18);
Dunno if that springs an idea or works- but most database engines will 
work through long lists of recIDs very fast. If you can get the results 
as a side effect of queries you need to make anyway, all the better.

One other idea:
repeat for each line l in (tOriginalList&cr&tRemoveList)
   if (tArray[l] is not empty) then delete tArray[l]
   else put l into tArray[l]
end repeat
combine tArray
This is off the top of my head, but the idea is: combine the lists and 
pass through once. If you already saw an item, it must need to be 
deleted (so empty the array item). Otherwise, just pop it into the 
array. Combine when done.

IOW- combine them and delete anything with a duplicate.
HTH!
Brian
On 4/3/05 11:24 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
Ken,
Would it help to
1. mark cards that need to be removed
2. sort by marked cards
3. delete the marked cards
Still a repeat loop, but each card would not have to be evaluated
during the loop.
Well, the problem is that it is not cards I'm dealing with but lists of
numbers (record IDs) that are returned from database calls.
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Yves COPPE
Le 4 avr. 05, à 07:23, Ken Ray a écrit :
On 4/3/05 10:49 PM, "Richard Gaskin" <[EMAIL PROTECTED]> 
wrote:

With 10,000 lines in my main list and 5,000 lines in my exclude list, 
it
takes only 25 milliseconds to use this on my single-processor PBG4 
1MHz:
Unfortunately this is something that will be executed in a loop several
thousand times, so even at 25ms * 2000 that ends up being 50 seconds, 
which
is way too long.



Hi Ken,
Try this :
on mouseUp
  answer excludeLines(fld "Liste2", fld "Liste1")
end mouseUp
function excludeLines pList1, pList2
   repeat for each line tLine in pList1
 put 1 into tArray[tLine]
   end repeat
   repeat for each line tLine in pList2
 if tArray[tLine] < 1 then
   put 2 into tArray[tLine]
   put tLine & cr after tRetVal
 end if
   end repeat
   delete char -1 of tRetVal
   return tRetVal
end excludeLines

here it works.
Greetings.
Yves COPPE
[EMAIL PROTECTED]
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Ken Ray
On 4/3/05 10:49 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote:

>
> With 10,000 lines in my main list and 5,000 lines in my exclude list, it
> takes only 25 milliseconds to use this on my single-processor PBG4 1MHz:

Unfortunately this is something that will be executed in a loop several
thousand times, so even at 25ms * 2000 that ends up being 50 seconds, which
is way too long.

I'll see what I can do with arrays - I'll let you all know how it turns out.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Ken Ray
On 4/3/05 11:24 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> Ken,
> Would it help to
> 1. mark cards that need to be removed
> 2. sort by marked cards
> 3. delete the marked cards
> Still a repeat loop, but each card would not have to be evaluated
> during the loop.

Well, the problem is that it is not cards I'm dealing with but lists of
numbers (record IDs) that are returned from database calls.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread simplsol
Ken,
Would it help to
1. mark cards that need to be removed
2. sort by marked cards
3. delete the marked cards
Still a repeat loop, but each card would not have to be evaluated 
during the loop.
Paul Looney
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Richard Gaskin
Ken Ray wrote:
I've got two lists - one with is the "comprehensive" list that is
return-delimited, like:
3
5
6
7
11
14
18
21
And another list which is the list I would like to *remove* from the
comprehensive list:
5
6
11
18
Which should give me:
3
7
14
21
I can of course do a repeat loop through the small list and remove those
items from the comprehensive list, but I'm wondering if there's a faster way
to do this. The numbers will always be sorted in ascending numeric order,
but there may be thousands of them, so I'm not looking forward to a repeat
loop. 
With 10,000 lines in my main list and 5,000 lines in my exclude list, it
takes only 25 milliseconds to use this on my single-processor PBG4 1MHz:
function ShortList pList, pExcludelist
  repeat for each line tLine in pList
if tLine is not among the lines of pExcludeList then
  put tLine & cr after tNulist
end if
  end repeat
  delete last char of tNuList
  return tNuList
end ShortList
--
 Richard Gaskin
 Fourth World Media Corporation
 __
 Rev tools and more: http://www.fourthworld.com/rev
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Dar Scott
On Apr 3, 2005, at 9:04 PM, Ken Ray wrote:
I can of course do a repeat loop through the small list and remove 
those
items from the comprehensive list, but I'm wondering if there's a 
faster way
to do this.
Some wild ideas:
1.  Convert the smaller list into a regex and use replaceText().
2.  Convert the long list to an array and loop through the smaller one 
and delete.  Oh, wait, that's a loop.

3.  Represent sets as arrays spanning the universe of numbers for your 
lists.  Represent your sets with these.  If a number is in the set, the 
value is 1.  If not, the value is 0.  Define intersection as *.  Define 
complement as take away one and times -1.  The set difference is the 
intersection with the complement of the set to be taken away.  Remember 
* and + can apply to arrays.

4.  Represent sets as a string of bits, 8 bits per char in a string.  
Use binaryDecode and binaryEncode and bitAnd and bitNot and loop 32 
bits at a time.  Whoops, that's looping, but each pass takes care of 32 
values in your universe.

5.  Take the middle line of the small list and find it or where it 
would be in the big list.  Concatenate the result of recursion of 
applying your function to the fronts and to the backs, where those do 
not include the middle line.

6.  I know it involves loops, but I have looped through both loops 
together and that was satisfactory for what I was doing, but I was not 
that happy with it.

Dar
--
**
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming Services and Software
**
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Monte Goulding

I've got two lists - one with is the "comprehensive" list that is
return-delimited, like:
3
5
6
7
11
14
18
21
And another list which is the list I would like to *remove* from the
comprehensive list:
5
6
11
18
Which should give me:
3
7
14
21
I can of course do a repeat loop through the small list and remove those
items from the comprehensive list, but I'm wondering if there's a faster 
way
to do this. The numbers will always be sorted in ascending numeric order,
but there may be thousands of them, so I'm not looking forward to a repeat
loop.
How about:
split the long list into an array
loop over the short list
delete array elements for each line of the short list
combine the long list
resort the long list
Should be faster than deleting a line in the middle of a long list but I 
could be wrong.

It's a pity we don't have an inverse of the intersect command.
Cheers
Monte 

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread Ken Ray
On 4/3/05 10:21 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> Ken,
> Is it possible to skip the "remove" items when the comprehensive list
> is built?

Nope... good thought, though...


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]



___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: How to get the difference between two lists?

2005-04-03 Thread simplsol
Ken,
Is it possible to skip the "remove" items when the comprehensive list 
is built?
Paul Looney

-Original Message-
From: Ken Ray <[EMAIL PROTECTED]>
To: Use Revolution List 
Sent: Sun, 03 Apr 2005 22:04:54 -0500
Subject: How to get the difference between two lists?
  I've got two lists - one with is the "comprehensive" list that is
return-delimited, like:
3
5
6
7
11
14
18
21
And another list which is the list I would like to *remove* from the
comprehensive list:
5
6
11
18
Which should give me:
3
7
14
21
I can of course do a repeat loop through the small list and remove those
items from the comprehensive list, but I'm wondering if there's a 
faster way
to do this. The numbers will always be sorted in ascending numeric 
order,
but there may be thousands of them, so I'm not looking forward to a 
repeat
loop.

Any ideas?
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
   
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


How to get the difference between two lists?

2005-04-03 Thread Ken Ray
I've got two lists - one with is the "comprehensive" list that is
return-delimited, like:

3
5
6
7
11
14
18
21

And another list which is the list I would like to *remove* from the
comprehensive list:

5
6
11
18

Which should give me:

3
7
14
21

I can of course do a repeat loop through the small list and remove those
items from the comprehensive list, but I'm wondering if there's a faster way
to do this. The numbers will always be sorted in ascending numeric order,
but there may be thousands of them, so I'm not looking forward to a repeat
loop. 

Any ideas?

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]
 


___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution