diff options
author | jao <jao@gnu.org> | 2022-10-14 04:53:51 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-10-14 04:53:51 +0100 |
commit | ca9223e0b2cac5a2cab6d967b7cd8b94082bba29 (patch) | |
tree | 1c0735c3fc65ef3e791dc75d03517288e72e80b7 /src/geiser | |
parent | 1e91a62f72d5403dc2651ab3f2156c446cbeed41 (diff) | |
download | geiser-chez-ca9223e0b2cac5a2cab6d967b7cd8b94082bba29.tar.gz geiser-chez-ca9223e0b2cac5a2cab6d967b7cd8b94082bba29.tar.bz2 |
wee refactorings
Diffstat (limited to 'src/geiser')
-rw-r--r-- | src/geiser/geiser-data.ss | 4 | ||||
-rw-r--r-- | src/geiser/geiser.ss | 18 |
2 files changed, 9 insertions, 13 deletions
diff --git a/src/geiser/geiser-data.ss b/src/geiser/geiser-data.ss index 0176e59..e4aeba7 100644 --- a/src/geiser/geiser-data.ss +++ b/src/geiser/geiser-data.ss @@ -26,9 +26,7 @@ (let ((id (car x)) (sgs (let* ((s (format "(~a)" (cadr x))) (as (with-input-from-string s read))) - (and (list? as) - (list? (car as)) - (map cdr (remove '~ as)))))) + (and (list? (car as)) (map cdr (remove '~ as)))))) (symbol-hashtable-set! h id (cons id (cons sgs (cddr x)))))) d) h)) diff --git a/src/geiser/geiser.ss b/src/geiser/geiser.ss index 9ec73e8..62cd6ad 100644 --- a/src/geiser/geiser.ss +++ b/src/geiser/geiser.ss @@ -187,7 +187,7 @@ (l (string-length s))) (if (<= l max-len) s (string-append (substring s 0 sub-len) sub-str)))) - (define (operator-arglist operator) + (define (id-autodoc id) (define (procedure-parameter-list id p) (and (procedure? p) (or (source->parameter-list p) @@ -199,21 +199,19 @@ (else `(("required" . ,(reverse req)) ("optional" ,args))))) (define (autodoc-arglist arglist) (autodoc-arglist* arglist '())) - (let ([binding (try-eval operator)]) + (define (signature as) `(,id ("args" ,@(map autodoc-arglist as)))) + (let ([binding (try-eval id)]) (if (not (eq? binding not-found)) - (let ([arglists (procedure-parameter-list operator binding)]) - (cond ((null? arglists) `(,operator ("args" (("required"))))) - (arglists - `(,operator ("args" ,@(map autodoc-arglist arglists)))) - (else `(,operator ("value" . ,(value->string binding)))))) - (let ((s (symbol-signatures operator))) - (if s `(,operator ("args" ,@(map autodoc-arglist s))) '()))))) + (let ([as (procedure-parameter-list id binding)]) + (if as (signature as) `(,id ("value" . ,(value->string binding))))) + (let ((s (symbol-signatures id))) + (if s (signature s) '()))))) (define (geiser:autodoc ids) (cond ((null? ids) '()) ((not (list? ids)) (geiser:autodoc (list ids))) ((not (symbol? (car ids))) (geiser:autodoc (cdr ids))) - (else (map operator-arglist ids)))) + (else (map id-autodoc ids)))) (define (geiser:symbol-location id . env) (let* ([b (try-eval id (current-environment))] |