diff options
Diffstat (limited to 'modules/language/python/dir.scm')
-rw-r--r-- | modules/language/python/dir.scm | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/modules/language/python/dir.scm b/modules/language/python/dir.scm index 2f23e35..36b4f02 100644 --- a/modules/language/python/dir.scm +++ b/modules/language/python/dir.scm @@ -82,18 +82,45 @@ (hash-for-each (lambda (k v) (set! l (cons k l))) h) (to-pylist (map symbol->string (sort l <)))))) -(define-method (dir (o <py-list> )) +(define-method (dir (o <py-list>)) (let ((l1 (pylist-listing))) (if (is-a? o <p>) - (let* ((l2 (next-method)) + (let* ((l2 (pk (next-method))) (l (+ l1 l2))) (pylist-sort! l) - l)))) + l) + l1))) + +(define-method (dir (o <py-hashtable>)) + (let ((l1 (pyhash-listing))) + (if (is-a? o <p>) + (let* ((l2 (pk (next-method))) + (l (+ l1 l2))) + (pylist-sort! l) + l) + l1))) + +(define-method (dir (o <py-string>)) + (let ((l1 (pystring-listing))) + (if (is-a? o <p>) + (let* ((l2 (pk (next-method))) + (l (+ l1 l2))) + (pylist-sort! l) + l) + l1))) -(define-method (dir (o <hashtable> )) pyhash-listing) -(define-method (dir (o <py-hashtable>)) pyhash-listing) -(define-method (dir (o <string> )) string-listing) - +(define-method (dir (o <hashtable> )) (pyhash-listing)) +(define-method (dir (o <string> )) (pystring-listing)) + +(define-method (dir) + (let ((l '())) + (module-for-each (lambda (m . u) + (set! l (cons (symbol->string m) l))) + (current-module)) + (let ((ret (to-pylist l))) + (pylist-sort! ret) + ret))) + |