Re: Sequence depths please explain
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Mar 28, 2002
- 417 views
Tony, It might also be useful/necessary to know if you have an empty sequence, and while just doing a length() test where you need it is probably better, here is the length test as a function (and also shows why you probably need to re-define your sequences ) : -- code begins: sequence test1, test2, test3, test4, test5 integer result test1 = {"Tony Steward"} -- main sequence has only one sequence test2 = {"Tony Steward","lockmaster 67 at aol.com<mailto:lockmaster67 at aol.com>",22432345} -- main sequence has more than one sequence test3 = {} test4 = {1} --test5 = {Tony Steward} -- gives ERROR: "Tony has not been declared" :) function WhatIsLengthOfSequence (sequence aSequence) integer L L= length(aSequence) if L = 1 then puts(1, "sequence is single\n") elsif L > 1 then puts(1, "sequence is multiple\n") else puts(1, "sequence is empty\n") end if return L end function -- tests: result = WhatIsLengthOfSequence(test1) result = WhatIsLengthOfSequence(test2) result = WhatIsLengthOfSequence(test3) result = WhatIsLengthOfSequence(test4) --result = WhatIsLengthOfSequence(test5) -- code ends Dan Moyer ----- Original Message ----- From: "Tony Steward" <tony at locksdownunder.com> To: "EUforum" <EUforum at topica.com> Sent: Monday, February 25, 2002 1:56 AM Subject: Sequence depths please explain > > Hi all, > How can I tell if a sequence is a single sequence of if it contains more > sequences. > > eg > test = {Tony Steward} -- Single sequence > test = {{Tony Steward}{lockmaster67 at aol.com}{22432345}} -- Multi > > Thanks Tony >