[gambit-list] getting symbol table

Nguyen Thai Ngoc Duy pclouds at gmail.com
Thu Jul 31 12:45:39 EDT 2008

On 7/31/08, Christian Jaeger <christian at pflanze.mine.nu> wrote:
> Nguyen Thai Ngoc Duy wrote:
> > I needed it to (try to) implement swank backend for gambit:
> >
>  cool

Well it can start slime, but nothing more :(

> > give a
> > prefix, return a more exact prefix (if any)
> >
>  What does "a more exact prefix" mean? Ignoring case sensitivity? Soundex
> based matching? ...

Let's take an example. Assume you only have symbols "abc"  and "abd",
then you type "a" and do completion. It should return "more exact
prefix" as "ab" along with  two possible completions that are "abc"
and "abd". That was what I observed from *slime-event* buffer.

> > and a list of possible
> > completions.
> >
> >
>  You should maybe tell more exactly how the api looks that swank expects.
> For really efficient matching you'll need to build some form of trees
> (tries, binary trees, or at least some sorted vectors), but on one hand
> swank might already contain those algorithms (I suppose you're porting the
> one for Scheme 48?), and if it doesn't, I think you could also get by with
> just walking the table vector and looking at every symbol string, if it's
> only for tab completion and similar functionality which is only checking the
> symbols at most once per each user input.

Input: a string for intial prefix
Output: `( (list of possible completions) <more exact prefix>)

I made something like that with bug 50 [1]. Unfortunately it was in C.
I am looking at the table vector to see how can I traverse it.

[1] http://www.iro.umontreal.ca/~gambit/bugzilla/show_bug.cgi?id=50

>  (filter (lambda (v) (and (symbol? v) (##global-var? v))) (vector->list
> (##symbol-table)))

I still have not had time to look closely to what you suggested. But
from the first look, it seems (vector->list (##symbol-table)) does not
contain all symbols. Will look into this later.


More information about the Gambit-list mailing list