Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
can you please review patch to port
clojure.pprint
to Basilisp. It addresses #513The approach taken aimed at minimizing modifications to the original code. There are two commits in this PR, the first is the original code taken from
clojure.pprint
, the second has all the necessary changes I've made to make it work in Basilisp.The code spans across seven files loaded into the
pprint
namespace. I've organized them underbasilisp.contrib.pprint
to denote that this is a contributed package, rather than something we've implemented from scratch. However, I don't have a specific preference for the location of these files.Since these files are
load
'ed at runtime rather than being required or imported, they inevitably cause noticeable delays when the namespace is initially imported, in line with the constraints outlined by #878. Two potential solutions come to mind to necessitate these files at compile time:Transform them into regular namespaces that are
require
d by the primary pprint namespace, as suggested. However, I would then need to figure out a way to integrate these variables into the top-levelpprint
namespace. I'm not sure there is a superuse
like form that will not only bring them into thebasilisp.pprint
namespace but also export them as public variables from there?Merge the files into a single extensive
pprint.lpy
file.What do you think?
The
pprint
tests follow the same approach and also need to be reorganized as above.The list of changes over the original implementations are
pprint.lpy
*warn-on-reflection*
since it is not applicable in Basilisp *warn-on-reflection* support #881utilities.lpy
array-map
under a hash map (order not preserved), Sorted sets, sorted maps, array maps #416defstruct
support using records, Missing core functions/macros #375proxy
support, taken from latest draft at Proxies #425lift-ns
andstrip-ns
fn, taken from Clojure verbatim.java.io.Writer
, required by pprint.column-writer.lpy
pprint_base
*print-sort-unordered-colls*
var, to order keys inmap, useful for the testing phase.
cl_format.lpy
seq
cannot be used as a field in a record (renamed to seqn), issue whendefrecord
field names have the same names as internal method names #758fractions/Fraction
as the type equivalent forclojure.lang.Ratio
num
fn (boxing numbers in java):params-keys
entry to store the order of the mockarray-map
.dispatch.lpy
*print-sort-unordered-colls*
var, so that prinout map output is predictable for testingagent
print out support, Agents #413clojure.lang.IPending
print out support (not sure what that is).isArray
support (not sure if this is relevant/supported?)basilisp.lang.interfaces/PersistentQueue
dispatch method, since it is not availableprint_table.lpy
tests
`test_helper.lpy
platform-newlines
test_cl_format.lpy
pr
to print out characters and thus are output as strings rather than characters.Thanks