Coder Social home page Coder Social logo

Comments (3)

kkinnear avatar kkinnear commented on August 17, 2024

Thanks for asking! This is an interesting problem, as the java.util.ArrayList doesn't trigger any of the "it must be one of these, print it this way", and just falls through into printing as a string. I'm sure that there are other Java types that will end up the same way. I'm tentatively open to the idea of some sort of class or type based transformation, although I'm not clear on where to put it. One option is for the things that don't show up as something else, another is to do it prior to the tests for what something is -- which is what you are implying, I think.

I'll give this some thought and see what I can figure out. If you happen to have any other examples of real-world Java classes that are getting the same (.toString ...) treatment, it would be interesting to have more than one example to experiment with and to write tests for. Thanks!

from zprint.

MrEbbinghaus avatar MrEbbinghaus commented on August 17, 2024

Maybe this is a case for clojure.datafy?

something -datafy-> data -zprint-> formatted string feels like a good way to separate the concerns.

from zprint.

kkinnear avatar kkinnear commented on August 17, 2024

This is now implemented in 1.2.9.

There is a new option map key to transform random Java classes into other, more manageable data types: :modify-sexpr-by-type.

I wrote up a whole big thing in the reference manual about how this works (using your example data above). Search the reference manual for :modify-sexpr-by-type and hopefully that will explain how to do what you want. Let me know if it isn't clear.

from zprint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.