Re: Help with Conversion Function

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

Hi CK Lester,
     I don't remember your code as I'm not at home and I don't have
your first mail but use my code as example. I don't have my computer to
test it so it's not sure to work but see the code and you'd understand
what you need.

---- UNTESTED CODE ----

function get2dseq(object x)
    sequence finalseq
    for I = 1 to length(x) do
       if atom(x[I]) then
           finalseq = finalseq & x[I]
       elsif sequence(x[I]) then
           finalseq = finalseq & get2dseq(x[I])
       end if
    end for
    return finalseq
end function

object testthis
sequence works
testthis = {53,42,13,{44,11},54}
works = get2dseq(testthis)

? works

----- END UNTESTED CODE -----

Best Regards, 
    Guillermo Bonvehi
    AKA: KNiXEUR - Caballero Rojo

------
Date: Wed, 30 Jan 2002 10:40:15 -0600
From: "C. K. Lester" <cklester at yahoo.com>
Subject: Re: Help with Conversion Function (Using Recursion)


Even as I consider it now, it doesn't seem like it would work. Don't I 
have
to append or & some stuff together if it's a sequence?

Anyway, I'm not at home where I have all my code, so it'll have to 
wait.

> > elsif sequence(x)
> >    callthesamefunction(x)
> > end if
> >
> > =)
>
> You know what? That's what I had initially, but my brain was
malfunctioning
> (it was late) and I couldn't perceive that would actually be the 
solution.
> Nor did I think to actually TEST it... :)
>
> Thanks, pampeano! :)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu