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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61305 in the body.
You can then email your comments to 61305 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to skribilo-bugs <at> nongnu.org:
bug#61305; Package skribilo. (Mon, 06 Feb 2023 00:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arun Isaac <arunisaac <at> systemreboot.net>:
New bug report received and forwarded. Copy sent to skribilo-bugs <at> nongnu.org. (Mon, 06 Feb 2023 00:02:02 GMT) Full text and rfc822 format available.

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

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: skribilo-bugs <at> nongnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH 0/2] Rewrite ast->string
Date: Mon,  6 Feb 2023 00:00:49 +0000
This patchset adds a test for ast->string and rewrites it as a
one-liner using string-join.

Arun Isaac (2):
  tests: Test ast->string.
  ast: Rewrite ast->string using string-join.

 src/guile/skribilo/ast.scm | 12 ++----------
 tests/ast.test             |  5 +++++
 2 files changed, 7 insertions(+), 10 deletions(-)

-- 
2.38.1





Information forwarded to skribilo-bugs <at> nongnu.org:
bug#61305; Package skribilo. (Mon, 06 Feb 2023 00:04:01 GMT) Full text and rfc822 format available.

Message #8 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 1/2] tests: Test ast->string.
Date: Mon,  6 Feb 2023 00:03:08 +0000
* tests/ast.test ("ast->string"): New test.
---
 tests/ast.test | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/ast.test b/tests/ast.test
index 1110faf..ed09bb0 100644
--- a/tests/ast.test
+++ b/tests/ast.test
@@ -1,6 +1,7 @@
 ;;; Excercise the AST routines.                  -*- Scheme -*-
 ;;;
 ;;; Copyright (C) 2009, 2012, 2021  Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright (C) 2023 Arun Isaac <arunisaac <at> systemreboot.net>
 ;;;
 ;;; This file is part of Skribilo.
 ;;;
@@ -64,6 +65,10 @@
                        (null? (cdr body))))))
          (null? (cdr body)))))
 
+(test-equal "ast->string"
+  "Blah."
+  (ast->string (document #:title "Foo" (chapter #:title "Bar" "Blah."))))
+
 (test-assert "`find-down' returns the empty list"
   (let* ((doc (document (chapter (section)) (chapter (section))))
          (lst (find-down (lambda (n) (is-markup? n 'chapter)) doc)))
-- 
2.38.1





Information forwarded to skribilo-bugs <at> nongnu.org:
bug#61305; Package skribilo. (Mon, 06 Feb 2023 00:04:02 GMT) Full text and rfc822 format available.

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





Reply sent to Arun Isaac <arunisaac <at> systemreboot.net>:
You have taken responsibility. (Tue, 28 Feb 2023 00:01:02 GMT) Full text and rfc822 format available.

Notification sent to Arun Isaac <arunisaac <at> systemreboot.net>:
bug acknowledged by developer. (Tue, 28 Feb 2023 00:01:02 GMT) Full text and rfc822 format available.

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

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 61305-done <at> debbugs.gnu.org
Subject: Re: bug#61305: Acknowledgement ([PATCH 0/2] Rewrite ast->string)
Date: Tue, 28 Feb 2023 00:00:04 +0000
Pushed!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Mar 2023 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 27 days ago.

Previous Next


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