leppie wrote:

You can just use 'environment-symbols'.

Aha... indeed! Thanks for the tip Leppie.

OK, here's take two:

(import (srfi :13))

(define (ge:completions prefix library)
  (filter (lambda (symbol)
            (string-prefix? prefix (symbol->string symbol)))
          (environment-symbols
           (environment library))))

Example:

> (ge:completions "lset" '(srfi :1))
(lset-diff+intersection! lset-xor! lset-difference!
  lset-intersection! lset-union! lset-diff+intersection
  lset-xor lset-difference lset-intersection lset-union
  lset-adjoin lset= lset<=)
>

Ed

Reply via email to