1. Appending to a "sequence"
- Posted by John F Dutcher <John_Dutcher at urmc.rochester.edu> Nov 18, 2004
- 504 views
This code errors on the "append(line, '{')" statement Can we not append an atom to a sequence ?
sequence line sequence recd fn=open("tml_extract.txt","r") if fn < 1 then puts(1, "Unable to open the disk file\n") abort(fn) else while 1 do line = {} append(line, '{') recd = gets(fn) if atom(recd) then exit else if equal(recd[2..5], "%HDR") or equal(recd[2..5], "%TRL") then a = 0 else append(line, recd) append(line, '}') ---puts(1, recd[1] recd[2] & "\n") puts(1, line[2] & "\n") end if end if end while end if
2. Re: Appending to a "sequence"
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Nov 18, 2004
- 496 views
On Wed, 17 Nov 2004 17:35:42 -0800, John F Dutcher <guest at RapidEuphoria.com> wrote: >This code errors on the "append(line, '{')" statement >Can we not append an atom to a sequence ? Presumably you meant line=append(line,'{') append is a function, its result must be assigned somewhere, Euphoria is optimised for the case where the result of append is assigned to the same variable as the first parameter. Regards, Pete
3. Re: Appending to a "sequence"
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 18, 2004
- 491 views
What's the error? On Wed, 17 Nov 2004 17:35:42 -0800, John F Dutcher <guest at rapideuphoria.com> wrote: > > posted by: John F Dutcher <John_Dutcher at urmc.rochester.edu> > > This code errors on the "append(line, '{')" statement > Can we not append an atom to a sequence ? > > }}} <eucode> > sequence line > sequence recd > fn=open("tml_extract.txt","r") > if fn < 1 then > puts(1, "Unable to open the disk file\n") > abort(fn) > else > while 1 do > line = {} > append(line, '{') > recd = gets(fn) > if atom(recd) then exit > else > if equal(recd[2..5], "%HDR") or equal(recd[2..5], "%TRL") then > a = 0 > else > append(line, recd) > append(line, '}') > ---puts(1, recd[1] recd[2] & "\n") > puts(1, line[2] & "\n") > end if > end if > end while > end if > </eucode> {{{ > > > > -- MrTrick
4. Re: Appending to a "sequence"
- Posted by Dave Probert <zingo at purpletiger.com> Nov 18, 2004
- 520 views
The format of the Append() command is as a function - ie, it returns a value. fred = append(fred, '{') would work ok. probably :) > while 1 do > line = {} > append(line, '{') > recd = gets(fn) > if atom(recd) then exit . .. : :: = == == = :: : .. . Server-Side DB driven web sites, Software Development and part-time games developer contact dave_p at purpletiger dot com . .. : :: = == == = :: : .. .