skribilo-bugs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61305: [PATCH 2/2] ast: Rewrite ast->string using string-join.


From: Arun Isaac
Subject: bug#61305: [PATCH 2/2] ast: Rewrite ast->string using string-join.
Date: Mon, 6 Feb 2023 00:03:09 +0000

* src/guile/skribilo/ast.scm (ast->string): Rewrite using string-join.
---
 src/guile/skribilo/ast.scm | 12 ++----------
 1 file 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)))
 
 
 
-- 
2.38.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]