Geoff,
I knew there was a reason I shouldn't have been sleeping in Math class.
Damn.
I figured from the repeating patterns in the result that there was most
likely a mathematical solution.
The fact that you know this explicitly really humbles me.
I am going to study this and try and learn some
I'm motivated to take it a step farther and generalize the handler
to deal with strings of any number of unique characters (albeit of
equal length):
[snip]
repeat for each line aPattern in it
get offset(aPattern,numberList)
repeat while it > 0
delete char it to (it+3) of num
(Anyone not interested in math hit delete right now)
I should have pointed out the formula for this. When choosing y objects
from x possible objects, the number of combinations xCy is
(x!)/(y!)*((x-y)!)
Where x! means x * (x-1) * (x-2) * ... * 2 * 1
In this case that translates to
7!/3!*(7-3)
Morning Everyone,
My virgin attempt at recursion apparently gave no one a rush except me.
Be that as it may, now that I've written a recursive handler, I'm
motivated to take it a step farther and generalize the handler to
deal with strings of any number of unique characters (albeit of equal
le
This one I am going to have to test but it is a third completely unique
approach.
It does use the 'is in' operator that Jac was suggesting and it is very
interesting.
That is what I love about scripting, the more people you talk to the
more different solutions you can find to a problem.
Thank
Jac,
I was testing only single digits for is among comma seperated BUT that
was not my problem because 'is in' would not have worked either due to
my method of deleting line of the original list instead of building a
separate list from the result.
Thanks though and I see I could have use the i
AAWW, But Geoff, you cheated because NOW you know there are only 35
possibles. At the beginning of this 'I' didn't know how many possible
groups of three there would be.
But, I like your first solution and will play with it today to increase
my understanding of transcript,
Thank you
Tom
On N
THAT's IT.. You got it right.
I knew it was going to be something like that.
Thanks Steve,
Tom
On Nov 22, 2003, at 3:14 AM, Steve Laming wrote:
Hi Thomas
Without running and testing it, which I may be able to do over the
weekend, my initial suggestion would be that as you are counting u
I'm a bit surprised that no one has brought up the REPLACE command in this
context. "replace WhateverText with empty in WhateverList" will *erase* all
instances of WhateverText from WhateverList in one fell swoop -- no need to
bother with silly repeat loops. Since the original problem specifi
So the first question is, you have a list of three digit numbers, some
of which are transposed copies of each other. You want to filter the
list so that any transposed duplicates are removed. This should work:
put empty into tNewList
repeat for each line L in tList
put sortChars(L) into
Hi Thomas
Without running and testing it, which I may be able to do over the weekend,
my initial suggestion would be that as you are counting up the set of
numbers and deleting frin the original set. It is likely that some of the
target numbers are moved with each deletion and therefore not tes
On 11/21/03 7:49 PM, Thomas J McGrath III wrote:
My real problem was that "is among" was not finding sets of groups that
were similar but transposed. In my need to find a solution I added the
part about converting a line like 123 into 1,2,3 so that "is among"
could work.
I really want to under
Class project:
A group of three items from the list 1,2,3,4,5,6,7 with no duplicates
in any order = 123 but no 213 or 312 or 231 or 321 and no doubles or
triples = 111 or 112 or 323 or 322 etc. (WOW my daughter is only 13 and
this in my opinion is complex until I figured it out)
What follows i
Here it is, folks: Rob's virgin attempt at recursion--
on mouseUp
put sansDuplicates(field "My List") into field "My List"
end mouseUp
function sansDuplicates numberList
if the number of lines of numberList < 2 then return numberList
put line 1 of numberList into targetLine
delete line
Steve, I see the coding bug got you, too. I used to spend nights
rewriting scripts with a friend of mine (who's name is steve too) and
we would try to get it down to the smallest number of lines. Ahh the
good old days.
Anyway, the problem called for no duplicate numbers in each group of
three
Ooops, 222 still gets deleted, so it would be better to explicitly test for
duplicates than rely on the addition test therefore:
On MouseUp
put false into found
put "1,2,3" into search$
-- sort field "myList"
repeat with x = the number of lines in field "myList" down to 1
put char 1 o
One last point, I'm not sure if you wanted to include numbers 111, 222,333,
311 etc as duplicates but if you didn't, a simple test to add the numbers
and check the total would suffice to ensure that only one of each number
was present, so that the code now becomes:
On MouseUp
put false into f
I couldn't resist testing it and here's what I came up with.
I created a field "myfield" loaded with test numbers and a Go button with
this script:
On MouseUp
put false into found
put "1,2,3" into search$
-- sort field "myList"
repeat with x = the number of lines in field "myList" down
I'll attempt to correct my own syntax errors:
put false into found
search$="1,2,3"
sort field "myList"
repeat with x = 1 to the number of lines in field "myList"
If char 1 of line x of mylist is among the items of search$ and
char 2 of line x of mylist is among the items of search$ and ch
Hi Thomas
I don't yet know revolution well enough to check your coding quickly, but
it does seem a little long winded.
Perhaps you could try something along these lines.
found=false
sort field "myList"
repeat with x = 1 to the number of lines in field "myList"
If char 1 of line x of myl
Mark,
Try the following script (it's not very elegant,
but it works - haven't tested it thoroughly though) :
Hope that helps,
JB
on mouseUp
set cursor to watch
put fld "myList" into L
put "" into S
put 0 into n
repeat with j=1 to (number of lines of L)-1
get line j of L
put
Hello to all of you wonderful REV developers.. :-)
I have a problem where I have a field filled with 3 single digit
numbers per line (210 lines). I wanted to find and delete any lines
that had ALL of the same numbers in it but in any order - so 123 and
213 and 321 and 312 would be duplicates a
22 matches
Mail list logo