Re: if statement not working
- Posted by Kat <gertie at PELL.NET> Mar 22, 2002
- 555 views
On 22 Mar 2002, at 17:07, kbochert at ix.netcom.com wrote: > -------Phoenix-Boundary-07081998- > Content-type: text/plain; charset=ISO-8859-1 > Content-transfer-encoding: quoted-printable <snip> > I was going to use '=3D=3D' but then '=3D=3D' and '=3D' seem backwards to > me. > There is great scope for artistry here-- how about (=3D) or lol ! > >> that acts like '=3D' except that it > >> plows on ahead in the face of errors: > >> s =3D~ t[2..4] > >> -- s is padded to length 3 if necessary > > >Since you specified [2..3], why pad s some more? And with what? > > Better to look at what t actually has, and deliver what is in > > the envelope of [2..3] and no more. If [2..3] doesn't exist, > > then return {}. If you asked to borrow a book that i don't have, > > i won't pad out a empty box of non-existant book with some > > random selection of book parts. > > If I ask you for a book and you are missing the last chapter, I > might appeciate getting what you have. Yes. I surely would not glue in enough pages from other books to make up the length of the original book, heh. > Your [2..3] confused me, so to make the sample clearer: > sequence t =3D "abcd" > sequence s =3D t[3..6] > I can see 4 possible results: > 1) "" > 2) "cd" > 3) "cd " > 4) Fatal Error > > I like 2), i.e. do the best you can. I agree. Nothing else makes sense in safe processing. It also take care of the req for "inf" as predefined constant, because defining it like: constant len len = 500000000000000 s = "123456789" ?s[5..len] -- "56789" (you know what i mean) Kat