Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 204805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:30:01+00:00 2026-05-11T17:30:01+00:00

A problem that has frequently come up in my career is I have some

  • 0

A problem that has frequently come up in my career is I have some kind of data structure (perhaps an s-expression) and I want to print it in a human readable form complete with reasonable indentation choices.

Is there a book or blog entry that describes how to do this elegantly? I am interested in the algorithm more than a specific library.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:30:01+00:00Added an answer on May 11, 2026 at 5:30 pm

    S-Exps are equivalent to tree structures, if you can pretty-print a tree you can pretty-print an s-exp.

    For instance, compare:

    (tree
        (value 89)
        (tree
            (value 9)
            nil
            nil)
        (tree
            (value 456)
            nil
            nil))
    

    to:

    89
     +- 9
     +- 456
    

    The algorithm is identical, the only difference is the ammount of surrounding data you want to print out.

    This paper describes an algorithm for pretty-printing trees

    This one describes a pretty-printer for programming languages

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that has been driving me batty. I have code that
I have a tricky problem that has had me scratching my head for a
I have a really silly problem that has cost me a load of time
We have a query in our system that has been a problem in the
When writing GUIs, I've frequently come over the following problem: Assume you have a
Here is a problem that has been bothering me a lot about Python, I
There was this problem that has been asked about implementing a load byte into
I'm noticing a problem that has crept up a few times over the years,
Possible Duplicates: Is there a problem that has only a recursive solution? Can every
I've run into the problem that has been addressed here without a workaround: I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.