]> gitweb.factorcode.org Git - factor.git/commitdiff
prettyprint.backend: lists only print car and "~more~" for cdr.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 16 Oct 2019 17:01:56 +0000 (10:01 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 16 Oct 2019 17:01:56 +0000 (10:01 -0700)
basis/prettyprint/backend/backend.factor

index fd9ce81f0ffcbadeccc50d2e9224d0df7d3e8b04..463a234c8a68ae2e23989ef5b8a198fc6a299a97 100644 (file)
@@ -266,11 +266,23 @@ M: object pprint* pprint-object ;
 M: vector pprint* pprint-object ;
 M: byte-vector pprint* pprint-object ;
 
+M: list pprint*
+    [
+        <flow
+        dup pprint-delims [
+            pprint-word
+            dup pprint-narrow? <inset
+            dup nil? [ drop ] [
+                [ car pprint* ]
+                [ cdr nil? [ "~more~" text ] unless ] bi
+            ] if block>
+        ] dip pprint-word block>
+    ] check-recursion ;
+
 : with-extra-nesting-level ( quot -- )
     nesting-limit [ dup [ 1 + ] [ f ] if* ] change
     [ nesting-limit set ] curry finally ; inline
 
-M: list pprint* pprint-object ;
 M: hashtable pprint*
     [ pprint-object ] with-extra-nesting-level ;
 M: curried pprint* pprint-object ;