James Hurley wrote:


Coming from FORTRAN, I have never really appreciated the more flexible use of arrays in Runtime Revolution. Your solution to the spell check problem is a Runtime revelation.

I know what you mean about the difference from Fortran to recent languages. I kind of wish they'd called them "dictionaries" (as Python does), or "hashes" (also "associative arrays") (as Perl and Ruby do), or something to remind everyone that Transcript has the powerful kind of array.



However a naive question: Since you only use the gArray, would it be possible somehow to store the information in the gArray in a file (I don't mean store all the 1's), and use that directly in the repeat loop, rather than store the dictionary gWords in a file and then have to construct the gArray?


You probably could read a line at a time and build the array from that - but it's much faster (and simpler) to read it all in at once, so I wouldn't even consider it.

You could of course read in the file into a local variable, and build the array from that. Then the space for the local variable would be reclaimed once you left the setup handler. That's what I would have done - using a global gWords was just a hangover from the first solution attempt. (The setup time is only 180 ms, so not a big deal).

You could change the file format to be
word,1
on each line - and then read the URL into gArray, and split it, as in
 split gArray by cr and comma
but (somewhat to my surprise) that is actually slower ?!

Or, you could keep the main dictionary in the stack, and only use the external file for custom additions - than there's no setup time.

Too many choices ....
-- Alex.


-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.6 - Release Date: 27/01/2005

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to