wish: option for pretty-print

Started by HPW, April 01, 2018, 12:41:23 AM

Previous topic - Next topic

HPW

Hello Lutz,



I had a wish for improving pretty-print.

Idea: I had problems in reading complex, nested lists which were saved with default pretty-print.

The problem is that on the first line are several list-items and on the following line one list per line.

For simple list it is pretty enough to be readable.

When symbols gets longer and more complex lists, I would like to see an option to use open-paranthese as line-seperators. The option could be activated by using a "(" instead of an integer.

Each open-paranthese would increase indent and the corrosponding close paranthese would decrease.

Sample-Call:

(pretty-print "(" " " "%1.16g")

Sample Output:

(set 'Symbolname
'("MainItem"
  ("Item1" "Value1")
  ("Item2" "Value2")
  ("Item3" "Value3")
  ("Item4" "Value4")
  ("Sublst"
   ("SubItem1" "SubValue1")
   ("SubItem1" "SubValue1")
   ("SubItem1" "SubValue1")
   ("SubList"
    (
     ("SubListItem1" "SubListValue1")
     ("SubListItem1" "SubListValue1")
     ("SubListItem1" "SubListValue1")
    )
   )
  )
 )
)


What do think?



Regards
Hans-Peter

HPW

#1
Hello,



My wish is the option for the lazy newlisp user. ;-)

For now I wrote my own special function to traverse the listtree and convert it to a stringstream.

The stringstream gets written to disk with write-file.

Then I have the control about indention and dynamic comments.

Still in love with newlisp.



Regards
Hans-Peter