problem

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

I'm trying to write a functon  to convert a sequence (of numbers and
strings) to a long string sequence.
i.e {1,2,{2002,12,30}} to "(1,2,"2002-12-30")"

the problem is to distinguish between the string "123" and the sequence
{1,2,3}.
they both have a length of 3 and all their elements are atoms.

can you improve on this? as it stands it has problems.
--        would be how it is used.
    for i = 1 to length(s) do
        if atom(s[i]) then
            out &= str(s[i])  else          ---<- this "str" function I
wrote to convert a number to a string
            if length(s[i]) = 3 then
                if atom(s[i][1]) and atom(s[i][2]) and atom(s[i][3]) then
                out &= "\"" & s[i] & "\", "
            end if
        end if
    end for
    out[length(out)] = ')'
    return out
end function

thanks for any suggestions

george

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

Search



Quick Links

User menu

Not signed in.

Misc Menu