diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-09-18 22:53:46 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-09-18 22:53:46 +0200 |
commit | 24f1360f694ec0f3e4cfc392a5392fef0576dd13 (patch) | |
tree | 4c693b0c75372d52289098a1b479931792b7e65a /scripts/module-introspection.scm | |
parent | Slightly better error handling in HTTP routes. (diff) | |
download | calp-24f1360f694ec0f3e4cfc392a5392fef0576dd13.tar.gz calp-24f1360f694ec0f3e4cfc392a5392fef0576dd13.tar.xz |
Move get-forms to module static-util.
Diffstat (limited to '')
-rw-r--r-- | scripts/module-introspection.scm | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/scripts/module-introspection.scm b/scripts/module-introspection.scm index dc430d8a..ba455cfc 100644 --- a/scripts/module-introspection.scm +++ b/scripts/module-introspection.scm @@ -1,38 +1,17 @@ (define-module (module-introspection) :use-module (srfi srfi-1) :use-module (hnh util) - :export (get-forms - uniq - unique-symbols + :export (unique-symbols find-module-declaration module-declaration? )) -(define (get-forms port) - (let loop ((done '())) - (let ((form (read port))) - (if (eof-object? form) - done - (loop (cons form done)))))) - - -(define (uniq lst) - (cond ((null? lst) lst) - ((null? (cdr lst)) lst) - ((and (pair? lst) - (eqv? (car lst) (cadr lst))) - (uniq (cons (car lst) (cddr lst)))) - (else (cons (car lst) - (uniq (cdr lst)))))) - - (define (unique-symbols tree) (uniq (sort* (filter symbol? (flatten tree)) string<? symbol->string))) - (define (module-declaration? form) (cond ((null? form) #f) ((not (pair? form)) #f) |