Re: Basic Euphoria Sequences

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

Some Slacker wrote:
> 
> Ok, I know, I'm a moron, but I really need a helping hand making
> new sequences, specifically...
> the number of elements in each sequence is a set of 14 (I think)
> sequences 2 of these sequences are themselves sequences but of 
> an unknown length perhaps one element but maybe more, and I need
> each sequence to be able to be looked at like sequence[1][3] for 
> obviously the third element of the first record... I'm not really 
> sure how to set this sequence in motion
> }}}
<eucode>
> NewRecord=repeat(0,14)
> -- this will make a 14 element sequence of 0's I know that, but how
> -- then do I make say elements 5 and 6 themselves sequences (with their
> -- own list of records) sequence[1][5][1..or more]
> </eucode>
{{{

> 
> I know this is a basic question, and I probably already know the 
> answer, but until I see it...   heh.
> 
> Thanks in advance,
> Some Slacker


I'm not sure what your trying to do but I would think:

</eucode>
{{{

--Writing: 
         seq[1][1]=atom_data
         seq[1][5]=seq_data

--Reading:

   for x=1 to 14 do
     if atom(seq[1][x]) then
        treat_as_atom()
    elsif sequence(seq[1][x]) then
        treat_as_sequence()
    end for

--or

   for x=1 to 14 do
     if length(seq[1][x])=1 then
        treat_as_atom()
    elsif length(seq[1][x])>1 then
        treat_as_sequence()
    end for

Hope this helps,

Don Cole
 A Bug is an un-documented feature.
A Feature is a documented Bug.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu