is among - problem

Rob Cozens rcozens at pon.net
Fri Nov 21 18:57:14 CST 2003


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 1 of numberList
    repeat with x = 1 to 3
      put targetLine into theDigits
      put char x of targetLine into targetString
      delete char x of theDigits
      repeat with y = 1 to 2
         put theDigits into tempDigits
         put char y of tempDigits into char 2 of targetString
         delete char y of tempDigits
         put tempDigits into char 3 of targetString
         get offset(targetString,numberList)
         repeat while it > 0
            delete char it to (it+3) of numberList
            get offset(targetString,numberList)
         end repeat
      end repeat
    end repeat
    return targetLine&return&sansDuplicates(numberList)
end sansDuplicates

-- 

Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.net/who.htm

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)


More information about the use-livecode mailing list