[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-gauche e70d9ed 019/119: Cleanup
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-gauche e70d9ed 019/119: Cleanup |
Date: |
Sun, 1 Aug 2021 18:27:49 -0400 (EDT) |
branch: elpa/geiser-gauche
commit e70d9eda98f786c163f96bc985667b097a269972
Author: András Simonyi <andras.simonyi@gmail.com>
Commit: András Simonyi <andras.simonyi@gmail.com>
Cleanup
---
geiser.scm | 65 +++++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 39 insertions(+), 26 deletions(-)
diff --git a/geiser.scm b/geiser.scm
index 80b9d35..648a026 100644
--- a/geiser.scm
+++ b/geiser.scm
@@ -25,6 +25,17 @@
(select-module geiser)
+;; Utility functions
+
+;; Get the list of elements before the dot in a "dotted list" of the form
+;; (x_1 x_2 ... x_n . y)
+(define (dotted-list-head dl)
+ (if (pair? (cdr dl))
+ (cons (car dl) (dotted-list-head (cdr dl)))
+ (list (car dl))))
+
+
+
(define (geiser:macroexpand form . rest)
(with-output-to-string
(cut pprint (macroexpand form))))
@@ -86,39 +97,41 @@
(let1 obj (global-variable-ref (find-module 'user) id)
(if (is-a? obj <procedure>)
(process-info (~ obj 'info))
- `(,id)))
+ `(,id ("args" (("required" "...")))
+ ("module" gauche))))
`(,id))))
(define (process-info info)
`(,(car info)
("args"
- ,(if (list? info)
- (let* ((required '("required"))
- (optional '("optional"))
- (key '("key"))
- (section :required))
- (dolist (x (cdr info))
- (case x
- ((:optional :key) (set! section x))
- ((:rest))
- (else (case section
- ((:optional) (push! optional x))
- ((:key) (push! key x))
- (else (if (symbol=? x 'args)
- (push! required "...")
- (push! required x)))))))
-
- (map (cut reverse <>)
- (list required optional key)))
- `(("required" ,@(process-dotted-info (cdr info)) "...")
- ("optional")
- ("key"))))
+ ,((if (list? info)
+ process-normal-arg-info
+ process-dotted-arg-info)
+ (cdr info)))
("module" user)))
-(define (process-dotted-info info)
- (if (pair? (cdr info))
- (cons (car info) (process-dotted-info (cdr info)))
- (list (car info))))
+(define (process-normal-arg-info arg-info)
+ (let* ((required '("required"))
+ (optional '("optional"))
+ (key '("key"))
+ (section :required))
+ (dolist (x arg-info)
+ (case x
+ ((:optional :key) (set! section x))
+ ((:rest))
+ (else (case section
+ ((:optional) (push! optional x))
+ ((:key) (push! key x))
+ (else (if (symbol=? x 'args)
+ (push! required "...")
+ (push! required x)))))))
+ (map (cut reverse <>)
+ (list required optional key))))
+
+(define (process-dotted-arg-info arg-info)
+ `(("required" ,@(dotted-list-head (cdr info)) "...")
+ ("optional")
+ ("key")))
;; Further
- [nongnu] branch elpa/geiser-gauche created (now 66e5143), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 56a765b 013/119: Add gauche to the list of active implementations, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche eb2c912 005/119: Cleanup geiser-gauche--startup, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 0656f2f 010/119: Fix geiser:eval, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 95333c1 004/119: Implement geiser-gauche--version, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 432f570 001/119: Create README.md, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche e70d9ed 019/119: Cleanup,
Philip Kaludercic <=
- [nongnu] elpa/geiser-gauche 202336b 006/119: Add case-sensitivity variable, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 60c95ca 002/119: Add initial version of geiser.scm and geiser-gauche.el, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 6da3f02 011/119: Fix geiser:eval, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche b474b09 014/119: Don't filter completions based on context (for now), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 9dafd9f 079/119: License-related updates, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 04208f5 075/119: Cleanup Cask file, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 687713c 085/119: Update README.md, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche f1ccc62 086/119: Update README.md, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche f9064d8 003/119: Implement get-module and other Emacs functions, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche ca7629e 012/119: geieser-gauche fixes, Philip Kaludercic, 2021/08/01