[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-chez a2d5fff 29/37: make autodoc support the proced
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-chez a2d5fff 29/37: make autodoc support the procedure defined by case-lambda. |
Date: |
Sun, 1 Aug 2021 18:26:00 -0400 (EDT) |
branch: elpa/geiser-chez
commit a2d5fff7fb7bd6fced44d613be48df6a81570534
Author: Jay Xu <jay.xu.krfantasy@gmail.com>
Commit: Jay Xu <jay.xu.krfantasy@gmail.com>
make autodoc support the procedure defined by case-lambda.
---
src/geiser/geiser.ss | 57 ++++++++++++++++++++++++++++------------------------
1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/src/geiser/geiser.ss b/src/geiser/geiser.ss
index 33d1b39..478b9af 100644
--- a/src/geiser/geiser.ss
+++ b/src/geiser/geiser.ss
@@ -98,39 +98,44 @@
(if s
(let ((form (s 'value)))
(if (and (list? form)
- (> (length form) 2)
- (eq? (car form) 'lambda))
- (cadr form)
+ (> (length form) 2))
+ (case (car form)
+ [(lambda) (list (cadr form))]
+ [(case-lambda) (map car (cdr form))]
+ [else #f])
#f))
#f)))
(define (operator-arglist operator)
- (let ((binding (eval operator)))
+ (define (make-autodoc-arglist arglist)
+ (let loop ([arglist arglist]
+ [optionals? #f]
+ [required '()]
+ [optional '()])
+ (cond ((null? arglist)
+ `(("required" ,@(reverse required))
+ ("optional" ,@(reverse optional))
+ ("key")
+ ;; ("module" ,module)
+ ))
+ ((symbol? arglist)
+ (loop '()
+ #t
+ required
+ (cons "..." (cons arglist optional))))
+ (else
+ (loop
+ (cdr arglist)
+ optionals?
+ (if optionals? required (cons (car arglist) required))
+ (if optionals? (cons (car arglist) optional) optional))))))
+ (let ([binding (eval operator)])
(if binding
- (let ((arglist (procedure-parameter-list binding)))
- (let loop ((arglist arglist)
- (optionals? #f)
- (required '())
- (optional '()))
- (cond ((null? arglist)
- `(,operator ("args" (("required" ,@(reverse required))
- ("optional" ,@(reverse optional))
- ("key")
- ;; ("module" ,module)
- ))))
- ((symbol? arglist)
- (loop '()
- #t
- required
- (cons "..." (cons arglist optional))))
- (else
- (loop
- (cdr arglist)
- optionals?
- (if optionals? required (cons (car arglist) required))
- (if optionals? (cons (car arglist) optional)
optional))))))
+ (let ([arglists (procedure-parameter-list binding)])
+ `(,operator ("args" ,@(map make-autodoc-arglist arglists))))
'())))
+
(define (geiser:autodoc ids . rest)
(cond ((null? ids) '())
((not (list? ids))
- [nongnu] elpa/geiser-chez fcb2a6a 22/37: add extra parameter support to chez, (continued)
- [nongnu] elpa/geiser-chez fcb2a6a 22/37: add extra parameter support to chez, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 21bc5bb 19/37: Delete trailing whitespace, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 6b9b733 12/37: Add geiser-chez-init-file, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 755a7cc 21/37: add extra parameter support to chez implementation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 98999d7 28/37: typo, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez dbebff9 31/37: preparing MELPA submission, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez e8065b4 33/37: compilation warnings (unused variable), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez fe3d881 36/37: whitespace, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 52b122a 34/37: emacs dependency, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 0c28f4b 32/37: Typo, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez a2d5fff 29/37: make autodoc support the procedure defined by case-lambda.,
Philip Kaludercic <=
- [nongnu] elpa/geiser-chez 4cb7f26 35/37: fix: auto-activate implementation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 03da1c1 37/37: Use new implementation extension declarator, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 4fcf6da 30/37: add built-in keywords and extra keywords customization, Philip Kaludercic, 2021/08/01