Re: suggestion sequence section
- Posted by gertie at visionsix.com Feb 11, 2003
- 462 views
On 11 Feb 2003, at 11:56, Carl W. wrote: > > Carl W. wrote: > > > gertie at visionsix.com wrote: > > > > > s = "abcdefgh" > > > x = "1..2" > > > ? s[x] > > > > That's equivalent to ? s[{49,46,46,50}] which other people have > > requested return a sequence containing the 49th, 46th, 46th again and > > 50th elements of s[]. > > > > Which interpretation is better? Discuss. :) I would really like to use the [ ] as delimiters for a range, but the programmer would need to remember to put them in quotes, anyhow, so i was dropping their use in strtok, and using the quotes alone. The problem is when you mix what i said and what Lucious said below...... > I know I'm replying to myself here, but a third interpretation occurred to > me after reading Lucius' response: > > String parse (Kat): > s["1..2"] --> s[1..2] > > Element selection (Lucius): > s[{49,46,46,50}] --> s[49] & s[46] & s[46] & s[50] > > Multidimensional access: > s[{49,46,46,50}] --> s[49][46][46][50] > > _Now_ which is the better interpretation? Aargh!! :) In strtok, I went with what i did there. But i also went with what Lucious said. There is a problem with typecasting tho, and i am a long way from done with it. In my opinion, if i cast a atom, add it to a sequence, i want to be able to pick that atom off the front of the sequence as an atom, like: s = gettok(s,{atom&".."&atom},32) But both atoms become sequence types when gettok gets them. So i don't think your type intseq below will work as (i) expected (but i didn't try, i'm *really* distracted atm). Making things more versatile, for ease of use and being bulletproof, means using value() and sprintf(), dragging down execution speed. Derek tossed me an idea, which i will be trying asap, but prolly not today. A local MD was dragging a scalpel thru my back for an hour this morning, so you can see i have things on my mind, and taped to my back. Sorry about being not up to par for now. Kat