From d74deac624de47c672e81c33db5fc39f244ec0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 17 Jul 2020 23:58:20 +0200 Subject: Properties now return alist instead of hashmap. --- module/vcomponent/describe.scm | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'module/vcomponent/describe.scm') diff --git a/module/vcomponent/describe.scm b/module/vcomponent/describe.scm index f6c77f55..69084679 100644 --- a/module/vcomponent/describe.scm +++ b/module/vcomponent/describe.scm @@ -7,31 +7,33 @@ (define ii (make-string indent #\space)) (define iii (make-string (1+ indent) #\space)) - (define maxlen (find-max (hash-map->list - (lambda (a _) (string-length (symbol->string a))) - (properties vcomponent)))) + (define maxlen (find-max (map + (lambda (a) (string-length (symbol->string a))) + (map car (properties vcomponent))))) (format #t "~aBEGIN ~a~%" ii (type vcomponent)) - (hash-for-each (lambda (key values) - (define (out vline) - (format #t "~a~a = ~a" - iii - (trim-to-width (symbol->string key) maxlen) - (trim-to-width - (format #f "~a" (value vline)) - (- 80 indent maxlen))) - (awhen (parameters vline) - (display " ;") - (for (key value) in it - (format #t " ~a=~a" key value))) - (newline)) - (if (list? values) - (for-each out values) - (out values))) - (properties vcomponent)) + (for-each (lambda (kv) + (let* ((key . values) kv) + (define (out vline) + (format #t "~a~a = ~a" + iii + (trim-to-width (symbol->string key) maxlen) + (trim-to-width + (format #f "~a" (value vline)) + (- 80 indent maxlen))) + (awhen (parameters vline) + (display " ;") + (for (key value) in it + (format #t " ~a=~a" key value))) + (newline)) + (if (list? values) + (for-each out values) + (out values)))) + (properties vcomponent)) (for child in (children vcomponent) + (describe child (+ indent 2))) (format #t "~aEND ~a~%" ii (type vcomponent))) -- cgit v1.2.3