]> gitweb.factorcode.org Git - factor.git/commitdiff
prettyprint.backend: print up to length-limit lists.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 24 Oct 2019 16:09:17 +0000 (09:09 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 24 Oct 2019 16:09:17 +0000 (09:09 -0700)
basis/prettyprint/backend/backend.factor

index 1e433709c52f6e4934e7d6ba1d580ca5ea98c10b..cd3d3882056e808aa8ea53e114902231d0f4b83f 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs byte-arrays byte-vectors classes
 classes.algebra.private classes.maybe classes.private
-classes.tuple combinators continuations effects generic
+classes.tuple combinators continuations effects fry generic
 hash-sets hashtables io.pathnames io.styles kernel lists make
 math math.order math.parser namespaces prettyprint.config
 prettyprint.custom prettyprint.sections prettyprint.stylesheet
@@ -271,8 +271,13 @@ M: cons-state pprint*
         dup pprint-delims [
             pprint-word
             dup pprint-narrow? <inset
-            [ car pprint* ]
-            [ cdr nil? [ "~more~" text ] unless ] bi
+            [
+                building get
+                length-limit get
+                '[ dup cons-state? _ length _ < and ]
+                [ uncons swap , ] while
+            ] { } make
+            [ pprint* ] each nil? [ "~more~" text ] unless
             block>
         ] dip pprint-word block>
     ] check-recursion ;