1. error?
- Posted by Kat <kat at kogeijin.com> Oct 24, 2002
- 505 views
Ok, if decimalcount = 1 (the debug screen says it is 1) then shouldn't this line crash?: resultnum = resultnum[1..decimalcount-1] & "." & resultnum[decimalcount..length(resultnum)] since it is the same as: resultnum[1..0] ? Kat
2. Re: error?
- Posted by Don Phillips <EuNexus at yahoo.com> Oct 24, 2002
- 468 views
--0-1993595551-1035513381=:35387 Actuall no, in Euphoria this is a perfectly valid statement. The docs are a wee bit hard to understand on this point, but it works out like this: slice[ # .. (anything greater than #) ] = a sequence slice[ # .. # ] = a sequence length 1 slice[ # .. #-1 ] = a sequence length 0 slice[ # .. (anything less than #-1) ] = error Ok, if decimalcount = 1 (the debug screen says it is 1) then shouldn't this line crash?: resultnum = resultnum[1..decimalcount-1] & "." & resultnum[decimalcount..length(resultnum)] since it is the same as: resultnum[1..0] ? Kat --------------------------------- Do you Yahoo!? Y! Web Hosting - Let the expert host your web site --0-1993595551-1035513381=:35387 Content-Type: text/html; charset=us-ascii <P>Actuall no, in Euphoria this is a perfectly valid statement. The docs are a wee bit hard to understand on this point, but it works out like this: <P>slice[ # .. (anything greater than #) ] = a sequence <P>slice[ # .. # ] = a sequence length 1</P> <P>slice[ # .. #-1 ] = a sequence length 0</P> <P>slice[ # .. (anything less than #-1) ] = error</P> <P> <B><I>Kat <kat at kogeijin.com></I></B> wrote: <BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">============ The Euphoria Mailing List ============ <BR><BR>Ok, if <BR>decimalcount = 1<BR>(the debug screen says it is 1)<BR>then shouldn't this line crash?:<BR><BR>resultnum = resultnum[1..decimalcount-1] & "." & <BR>resultnum[decimalcount..length(resultnum)]<BR><BR>since it is the same as:<BR>resultnum[1..0] <BR>?<BR><BR>Kat<BR><BR>==^================================================================<BR>This email was sent to: EuNexus at yahoo.com<BR><BR>EASY UNSUBSCRIBE click here: http://topica.com/u/?b1dd66.b3deX6.RXVOZXh1<BR>Or send an email to: EUforum-unsubscribe at topica.com<BR><BR>T O P I C A -- Register now to manage your mail!<BR>http://www.topica.com/partner/tag02/register<BR>==^================================================================<BR></BLOCKQUOTE><p><br><hr size=1>Do you Yahoo!?<br> <a href="http://webhosting.yahoo.com/ ">Y! Web Hosting</a> - Let the expert host your web site --0-1993595551-1035513381=:35387--
3. Re: error?
- Posted by Juergen Luethje <jluethje at gmx.de> Oct 24, 2002
- 512 views
Don Phillips <EuNexus at yahoo.com> wrote: > Actuall no, in Euphoria this is a perfectly valid statement. The docs > are a wee bit hard to understand on this point, See refman_2.htm, 2.2.6 'Slicing of Sequences': "x[3..2] is also allowed. It evaluates to the length-0 sequence {}." > but it works out like this: > slice[ # .. (anything greater than #) ] = a sequence > slice[ # .. # ] = a sequence length 1 > > slice[ # .. #-1 ] = a sequence length 0 > > slice[ # .. (anything less than #-1) ] = error > > > Ok, if > decimalcount = 1 > (the debug screen says it is 1) > then shouldn't this line crash?: > > resultnum = resultnum[1..decimalcount-1] & "." & > resultnum[decimalcount..length(resultnum)] > > since it is the same as: > resultnum[1..0] > ? > > Kat Regards, Juergen
4. Re: error?
- Posted by jbrown105 at speedymail.org Oct 25, 2002
- 500 views
On 0, Kat <kat at kogeijin.com> wrote: > > Ok, if > decimalcount = 1 > (the debug screen says it is 1) > then shouldn't this line crash?: > > resultnum = resultnum[1..decimalcount-1] & "." & > resultnum[decimalcount..length(resultnum)] > > since it is the same as: > resultnum[1..0] > ? > > Kat > No. resultnum[1..0] is the empty sequence {} resultnum = resultnum[1..decimalcount-1] & "." & resultnum[decimalcount..length(resultnum)] is the same as resultnum = resultnum[1..0] & "." & resultnum[1..length(resultnum)] jbrown Linux User:190064 Linux Machine:84163 --
5. Re: error?
- Posted by Kat <kat at kogeijin.com> Oct 25, 2002
- 504 views
On 25 Oct 2002, at 23:32, jbrown105 at speedymail.org wrote: > > On 0, Kat <kat at kogeijin.com> wrote: > > > > Ok, if > > decimalcount = 1 > > (the debug screen says it is 1) > > then shouldn't this line crash?: > > > > resultnum = resultnum[1..decimalcount-1] & "." & > > resultnum[decimalcount..length(resultnum)] > > > > since it is the same as: > > resultnum[1..0] > > ? > > > > Kat > > > > No. > > resultnum[1..0] is the empty sequence {} I can't help but consider that non-standard to Eu's way. It's one atom long, it should be one atom returned. Or since Rob doesn't want to return reversed sequences if we do s = s[length(s)..1] then s[1..0] should crash as a reversed sequence of as a "upper index is less than 1" error. Reliable crashing is as important as reliable non-crashing, isn't it? Kat