Re: Distinction between string and sequence
- Posted by Vincent <darkvincentdude at yahoo.com> Dec 22, 2004
- 429 views
Greg Haberek wrote: > > > seq={{52,49,53},"415"} > > > "415" <-- I'd like hier to see: {52,49,53} > > "415" > > Unfortunately, {52,49,53} and "415" are the same internally (to the > interpreter). You have to determine when a sequence is a string and > when it is plain data. You'd have to do something like this: > > }}} <eucode> > sequence a > > a = {52,49,53} > > print(1, a) -- outputs {52,49,53} > printf(1, "%s", {a}) -- outputs "415" > > </eucode> {{{ > > This should do it also...
-- Disiguish a string from a sequence include get.e include misc.e constant COUT = 1 integer halt sequence elem elem = {{52,49,53},"415"} sequence val val = value(elem[1]) sequence str str = {val[2], elem[2]} print(COUT, reverse(str)) halt = wait_key()
Vincent