Re: Newbie question. Difficulty understanding a few things.
- Posted by Mike777 <anon4321 at gm?il?com> May 25, 2008
- 686 views
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. Me thinks that you didn't read my entire message closely. Go back to the part where I talked about the construct you are looking for clarification about being the equivalent to an array which would be represented by: "seek_positions(element,1)" You really need to read up on sequences and how they are shown. For example: seek_positions[element][1] is the Euphoria way of representing something which is probably more familiar to you as: seek_positions(element,1) Sequences are essentially very flexible arrays where each individual element can be either a number or another (embedded) sequence. This can get very complicated, very quickly. It is also amazingly powerful. But if you think of them as nothing more than arrays, you will begin to understand them. Let's go the other direction. Say you have a 5 by 5 array, so you have 25 elements (and let's make it a 1-based array rather than a zero-based array, for convenience) The first element would be array(1,1) and the last would be array(5,5). They would be shown as: array[1][1] and array[5][5] in Euphoria. So, the [1] that you are asking about is nothing more than the array index for the second element of a two-element index of the seek_positions variable (which in Euphoria is a sequence but in other languages would be called an array). As far as what the -1 does, that says "subtract 1" from the result you determined by looking at the specific element within the seek_positions sequence found at the index of {element,1). It might be helpful if you say what computer language you have the most experience with. That way, people here can make reference to that language when explaining Euphoria's methods. If this isn't clear, come back at us again. Mike