I am writing an adverb which sets of a chain of time-comsuming calculations
and want to cache the results automatically to disk.

To achieve this I will:

 Generate a hash code of its input parameters (a gerund (u) with the code
converted to a string and a string (y) concatenated with the adverb name to
make a string),
 Look for a file with the same name as the hash code,
 EITHER load the file if it exists OR do the calculation as asked and then
save results to a binary file with the hash code as a name.


The idea is to "auto-cache" the results of lengthy calculations that calls
to that adverb creates.

To generate the "unique" hash code I intend to use:

(  2: { [: ; (0: s: 2:) {~ [: 6&s: [: s: ' '&~: # ]) (3!:1)
'stringofinputparameters'

I do not know much about hash codes though. Is the hash code unique? What
does the column "color" mean in the symbol table, do I need to include it in
the hash code to make it unique? Is there any reference material that I
could read to learn more about the subject, so far I can only find the
dictionary entry.


Thanks in advance,
Matthew.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to