[plt-scheme] (fast) reading of data files into a hash-table - how?

From: Yoav Goldberg (yoav.goldberg at gmail.com)
Date: Sat Dec 31 14:29:43 EST 2005

On 12/31/05, Chongkai Zhu <mathematica at citiz.net> wrote:
> If your hash table doesn't needs any modification, edit a source file as:
>
> (module a-hash-table mzscheme
>   (provide a-hash-table)
>   (define a-hash-table
>     (make-immutable-hash-table
>      ;your data line by line here
>      ;in assoc-list form
>      'equal)))
>
> Then compile this file. Every time you need the hash-table, require the
> compiled module.

I tried something quite similar:
(module data mzscheme
   (require (lib "etc.ss"))
   (provide get-data)
   (define *hashtable*
       (hash-table 'equal
       ;; my data
       ))
   (define (get-data k) (hash-table-get ...) )))

And then tried to compile it (using mzc --extension --auto-dir data.scm)
mzc worked for several minutes(!) producing a ~600k .dll file, and
then I tried to require "data.scm", and got a windows runtime error...

Any idea why?

thanks,
Yoav


Posted on the users mailing list.