on 17/5/02 5:28 PM, Karl Petersen at [EMAIL PROTECTED] wrote:

> It's possible to do the same with a script that uses fixed-length
> numbers to store the start-of-line positions in an index. If all
> index numbers are the same length, a script can easily calculate the
> location of any index member, read that number from the index file,
> then use it to read one line from the data file.
[...snip...]
> In Rev, one might store index numbers as binary data, allowing the
> index file to be smaller. If might even allow the index to be stored
> in memory. Rev's "repeat for each line L of <data>" is so fast it
> should be possible to build an index quickly, a task normally
> requiring an external.

Or, unless memory is a huge issue, why not use the very fast arrays in
combination with the very fast 'repeat for each' loop, to store the actual
contents of each line in an index, keyed under the line.  Ie

    put empty into myarray
    put 1 into lineNum
    repeat for each line L of data
        put L into myarray[lineNum]
        add 1 to lineNum
    end repeat

 
  Ben Rubinstein               |  Email: [EMAIL PROTECTED]
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866


_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to