Nguyen Thai Ngoc Duy wrote:
I needed it to (try to) implement swank backend for gambit:
cool
give a prefix, return a more exact prefix (if any)
What does "a more exact prefix" mean? Ignoring case sensitivity? Soundex based matching? ...
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.
(filter (lambda (v) (and (symbol? v) (##global-var? v))) (vector->list (##symbol-table)))
Christian.