Stupid Newbie-sounding question.

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

Ok..I know this is a stupid newbie-sounding question....and I've always avoided
this issue, because I didn't know how to do it...
But, this time, it seems unavoidable...

I have a sequence of variables, which contains atoms, integers, sequences, text,
etc...

I am trying to save each variable on separate lines of a file, that could easily
be edited....the data file would look simliar to this..
   2341  NAME John
   3432  AGE   34
   2341  FLAGS {a sequence of flags}

etc..

anyway..here's the problem i'm having...ok..without using a loop..it's easy to
save that to a file..like this...
   puts(id,sprint(variable_for_idnumber))
   puts(id," ")
   puts(id,variable_for_what_variable_this_id)
   puts(id," ")
   puts(id,variable_for_the_variable_value)
   puts(id,"\n")

ok..here's where i have my problem...as far as "flags" and "age"..it's easy...I
can say..
  if atom(variable_for_the_variable_value) then
     print(id,sprint(variable_for_the_variable_value)
  else
     puts(id,variable_for_the_variable_value)
  end if

but the problem with that is that it prints "John" as a string of the ascii
codes, instead of an easily editable "John"..
if i add if sequence() it counts "John" as a sequence, just like the sequence
  of flags..
so my question is...
how i can (within a loop) tell it to evaluate whether to puts or print?

bah..told you it was a stupid newbie question

Michelle Rogers

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

Search



Quick Links

User menu

Not signed in.

Misc Menu