Re: Newbie question. Difficulty understanding a few things.
- Posted by don cole <doncole at ?acbell?net> May 25, 2008
- 744 views
Dan Moyer wrote: > > don cole wrote: > > > > Rob H. wrote: > > > > > > > > > I understand what seek is doing. However. The seek_positions[element] > > > determines > > > where seek is currently "looking" because it's incrementing with the for > > > element > > > loop. > > > So why is the [1] necessary?? Not sure if I'm explaining myself > > > correctly... > > > In the Reference Manual, seek only takes one argument... I'm wondering > > > what > > > the [1] and -1 specifically do. > > }}} <eucode> > > seek_positions = {} > > for element = 1 to length(string) do > > if find(string[element],vowels) then > > seek_positions = append(seek_positions,{element, string[element]}) > > string[element] = ' ' > > end if > > end for > > </eucode> {{{ > > > > Here we are building a 2 element sequence called seek_positions. > > > > the first element being the element number. > > > > the second element being a string (' ') > > > > in the code > > seek_positions[1][1]=1 > > seek_positions[1][2]=' ' > > > > seek_postition[2][1]=2 > > seek_positions[2][2]=' ' > > > > etc... > > > > so seek_positions[2][1]-1=1 > > seek_positions[5][1]-3=2 > > > > Don Cole > > Hi Don, > > That's not exactly right, I think. > > Yes, seek_positions is a two element array, but the empty space ' ' is > not being added to seek_positions, but rather is REPLACING a character in > string: string[element] = ' ' > > seek_positions has an item added each time a vowel is found, and that item > consists of the position counter ("element") and the vowel itself. > > Dan yeah! your right I missed that if find there. Don Cole