Commit 1745d2f8 authored by Per Bothner's avatar Per Bothner

Handle circular lists in display procedure.

Fixes GitLab issue #78 "Cycles detection in REPL".
* DisplayFormat.java (schemeDisplayFormat): Set checkSharing.
(schemeDisplaySimpleFormat): New static.
* circlist.scm: Test display of circular list.
parent 42f88a1d
Pipeline #216233381 failed with stage
in 5 minutes and 11 seconds
2020-11-14 Per Bothner <per@bothner.com>
* DisplayFormat.java (schemeDisplayFormat): Set checkSharing.
Fixes GitLab issue #78 "Cycles detection in REPL".
(schemeDisplaySimpleFormat): New static.
2020-03-24 Per Bothner <per@bothner.com>
* CompileArith.java (getReturnKind): Fix for DIVIDE_GENERIC.
......
......@@ -96,6 +96,8 @@ public class DisplayFormat extends GenericFormat
public static final ThreadLocation outRadix
= new ThreadLocation("out-radix");
public static final DisplayFormat schemeDisplaySimpleFormat
= new DisplayFormat(false, 'S');
public static final DisplayFormat schemeDisplayFormat
= new DisplayFormat(false, 'S');
......@@ -106,6 +108,7 @@ public class DisplayFormat extends GenericFormat
public static final DisplayFormat schemeWriteSharedFormat
= new DisplayFormat(true, 'S');
static {
schemeDisplayFormat.checkSharing = 0;
schemeWriteFormat.checkSharing = 0;
schemeWriteSharedFormat.checkSharing = 1;
}
......
2020-11-14 Per Bothner <per@bothner.com>
* circlist.scm: Test display of circular list.
2020-06-30 Duncan Mak <duncanmak@gmail.com>
* match1.scm: Test for match for nested literal.
......
......@@ -8,3 +8,12 @@
(write (circular-list 3 1 4 1 5))
(newline)
;; Output: #0=(3 1 4 1 5 . #0#)
;; GitLab issue #78
(let ((x (list 1 (list "2") 3)))
(set-cdr! (cadr x) (cdr x))
(set-cdr! (cddr x) x)
(write x) (newline)
(display x) (newline))
;; Output: #0=(1 . #1=(("2" . #1#) 3 . #0#))
;; Output: #0=(1 . #1=((2 . #1#) 3 . #0#))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment