Re: Newbie question. Difficulty understanding a few things.

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu