Re: typecasts again
- Posted by "Carl W." <euphoria at cyreksoft.yorks.com> Jan 10, 2003
- 480 views
Kat wrote: > This line: > > while sequence(TheWebPage[junk][1]) and match(" ",TheWebPage[junk][1]) > do > > errors out with : > > attempt to subscript an atom > (reading from it) > > Since TheWebPage[junk] is a sequence, > TheWebPage[junk][1] is a sequence, where is it an atom?? If by some error, the element at TheWebPage[junk] is an atom and not a sequence, attempting to further index it with the [1] would cause the error you're getting. Try: while sequence(TheWebPage[junk]) and sequence(TheWebPage[junk][1]) and match(" ",TheWebPage[junk][1]) do -- etc. end while Then again, I'm not sure whether 'while' short-circuits like 'if' does. I know that return expressions in types and functions don't (In Eu2.3). So, this would still fail if there's no short-circuiting on the 'while' condition. A messy, guaranteed to short-circuit and work as expected workaround is: while 1 do if sequence(TheWebPage[junk]) and sequence(TheWebPage[junk][1]) and match(" ",TheWebPage[junk][1]) then else exit end if -- etc. end while HTH, Carl -- [ Carl R White == aka () = The Domain of Cyrek = ] [ Cyrek the Illogical /\ www.cyreksoft.yorks.com ]