summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2023-01-28 01:38:07 +0000
committerArun Isaac2023-02-27 23:55:09 +0000
commitf38bbcf4e9bf89a733699d3768ee9e44ddca0992 (patch)
treec504b5b0e6363e5237202f89ad44cd77af4005f9
parent10d26f3b35cac5bd27c450fcb99377666a9e2eed (diff)
downloadskribilo-f38bbcf4e9bf89a733699d3768ee9e44ddca0992.tar.gz
skribilo-f38bbcf4e9bf89a733699d3768ee9e44ddca0992.tar.lz
skribilo-f38bbcf4e9bf89a733699d3768ee9e44ddca0992.zip
ast: Rewrite ast->string using string-join.
* src/guile/skribilo/ast.scm (ast->string): Rewrite using string-join.
-rw-r--r--src/guile/skribilo/ast.scm12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/guile/skribilo/ast.scm b/src/guile/skribilo/ast.scm
index 4a39ebf..003619f 100644
--- a/src/guile/skribilo/ast.scm
+++ b/src/guile/skribilo/ast.scm
@@ -3,6 +3,7 @@
;;; Copyright 2003, 2004, 2009 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;; Copyright 2003, 2004 Manuel Serrano
;;; Copyright 2005, 2006, 2007, 2012, 2013, 2015, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2023 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;;
;;; This file is part of Skribilo.
@@ -206,16 +207,7 @@
(define-method (ast->string (ast <number>)) (number->string ast))
(define-method (ast->string (ast <pair>))
- (let ((out (open-output-string)))
- (let Loop ((lst ast))
- (cond
- ((null? lst)
- (get-output-string out))
- (else
- (display (ast->string (car lst)) out)
- (unless (null? (cdr lst))
- (display #\space out))
- (Loop (cdr lst)))))))
+ (string-join (map ast->string ast)))