Arc Forumnew | comments | leaders | submitlogin
Auto-format function for arc code
3 points by thaddeus 5962 days ago | 2 comments
So I started writing some code to read in my arc functions in an attempt to create an auto-format routine that inserts indentation and linebreaks to present my code 'correctly' (this being cause I suck at typing this on my own and find my self wondering how it should even be done).

Anyway I started by using w/infile readall.... and noticed in doing so the readall fn was expanding the code ....eg. '(fn stuff) was converted to (qoute (fn stuff)). So I started to parse the code via 'instring' to un-expand the code as a first step.

Thought it was worth asking if anyone has taken a stab at this? Is it a case where there are soooo many variances code formatting that it becomes not worth it ? Am I walking down a road that makes little sense....

Thanks. T.



3 points by conanite 5961 days ago | link

pprint.arc might have what you're looking for - routines for pretty-printing. It's at the top level of the arc distribution.

-----

1 point by thaddeus 5960 days ago | link

That did the trick (I figured this must have been done a million times before) :)

Thanks. T.

-----