On Thu, 9 Dec 2010, Raymond Toy wrote:
< On 12/9/10 1:18 PM, Leo Butler wrote:
< > I have spent a bit of time re-writing build_index.pl in lisp.
< > I have a functional version that appears to work independent
< > of the encoding.
< >
< This is interesting. I had thought about reinstating the old cl-info
< code that groveled the maxima.info file to get the tags and
< everything. And the character offsets there would have worked just
< fine if we read in the whole info file (only takes a 10 ms on a slow 750
< MHz machine with cmucl) and extracted the data using the character offset.
<
Yes, my code slurps in all the info files and extracts the tag information.
At the moment, I am writing some code for cl-info to patch its search
functions, so they use the in-memory data rather than reading from disk
for each search. (See below).
< > I think that there are several advantages to having the help index
< > built in lisp:
< > -as mentioned, this avoids encoding issues because the index can
< > be built at runtime;
< > -the present code can accomodate several master info files, which
< > would allow a usser to add documentation, including 3rd party
< > documentation at runtime;
< > -the code runs in about 2sec on a netbook+sbcl, so it is practical
< > to build the index on demand (e.g. when the first help query is made).
<
< That is a little slow. Way back when with the old cl-info code, a 300
< MHz machine with clisp could get entries in under a second. Fast
< enough that no one really cared.
Well, the notebook was running on battery. On an old T43
(1.8GHz), loading the source file is so fast that I thought at first
there must be some hiccup and the code was not being executed.
< > Here's the cost: it's written with the cl-ppcre regex library that
< > provides most Perl regexes for CL. Personally, I think that it
< > is worth adding this to the Maxima code base, because nregex is,
< > well, pretty primitive.
< Maxima uses nregex because cl-ppcre didn't exist at the time, plus it
< was more than capable of doing the regex matches needed by cl-info at
< that time.
<
< Does cl-ppcre handle unicode? Do we need it to handle unicode? Perhaps
< not.
Good question.
---
One final thing: the cl-info code is using hashes, my code uses alists.
I didn't notice this til I moved to a different machine running a
different lisp. It appears that Lisps handle the existence of hashes vs.
alists differently. In case you are seeing gibberish, I have included
patched search functions at
http://www.maths.ed.ac.uk/~lbutler/build-index.lisp
Run a command like
:lisp (cl-info::read-info-text (car (find-regex-matches "^expand$" cl-info::*info-deffn-defvr-pairs*)))
to make sure you are really seeing my code at work.
Leo
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.