GNU bug report logs - #61305
[PATCH 0/2] Rewrite ast->string

Previous Next

Package: skribilo;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Mon, 6 Feb 2023 00:02:01 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 61305 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61305 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [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 <at> unice.fr>
 ;;; Copyright 2003, 2004  Manuel Serrano
 ;;; Copyright 2005, 2006, 2007, 2012, 2013, 2015, 2018  Ludovic Court�s <ludo <at> gnu.org>
+;;; Copyright 2023 Arun Isaac <arunisaac <at> 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





This bug report was last modified 2 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.