Re: Sequence depths please explain

new topic     » goto parent     » topic index » view thread      » older message » newer message

Tony,

If you re-define your sequences as I think you must,
like so:

test1 = {"Tony Steward"} -- main sequence contains only one sequence
test2 = {"Tony Steward","lockmaster
67 at aol.com<mailto:lockmaster67 at aol.com>",22432345}   -- main sequence
contains more than one sequence

then all you have to do is use "length()" to test them:



sequence test1, test2
integer L

test1 = {"Tony Steward"} -- main sequence has only one element
test2 = {"Tony Steward","lockmaster
67 at aol.com<mailto:lockmaster67 at aol.com>",22432345}   -- main sequence has
more than one element


-- tests:
L = length(test1)
if L = 1 then
   puts(1, "sequence is single\n")
elsif L > 1 then
   puts(1, "sequence is multiple\n")
end if

L = length(test2)
if L = 1 then
   puts(1, "sequence is single\n")
elsif L > 1 then
   puts(1, "sequence is multiple\n")
end if

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
>
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu