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 3941954
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:36:17+00:00 2026-05-20T00:36:17+00:00

I am currently writing a LISP program which analyses the CR results in the

  • 0

I am currently writing a LISP program which analyses the CR results in the form of lists like following:
(“I” 0 10 0 20) << (word X0 X1 Y0 Y1)

It must build the whole text using positions of words.
My code has a cluster analyser which finds out cluster layouts like paragraphs with left- alignment or right or even both. A cluster data structure seems like this:
(“cluster name” xline y0 y1 ‘(cluster words))

How can i add a new line while i am iterating over a list of strings and concatenate them into result string to create a formatted text from these?
Example:

"Hi,\n
\n
here is my entry\n
\n
Good bye"

My code seems like following:

(defun print-formatted-text(txt)
  (let
      ((size   (array-total-size txt))
       (sorted (sort (sort txt #'compare-mix) #'compare-generic2))
       (result ""))
    (loop for i from 0 to (1- size) do
          (let ((el (aref sorted i)))
            (if (word? el)
                (setf result (concatenate 'string result (first el) " "))
              (if (null (nth 7 el))
                  nil
                (progn
                  (setf result (concatenate 'string result " "))
                  (dolist (curr (nth 7 el))
                    (setf result (concatenate 'string result (first curr) " "))))))))
    result))

If the current data isn’t a word, then it is a paragraph. It means, i need to add a new line before i give the words of paragraph out and after.

Is the usage of concatenate properly here?

Thank you for your advices.

  • 1 1 Answer
  • 0 Views
  • 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-20T00:36:17+00:00Added an answer on May 20, 2026 at 12:36 am

    I can’t quite follow your program, but it’s much easier to work with string-streams and use format, write-string, write-line, terpri, and related functions, e.g.

    (let ((lines '("Hi," "Here is my entry" "Good bye")))
      (with-output-to-string (stream)
        (dolist (line lines)
          (write-line line stream)
          (terpri stream))))
    =>
    "Hi,
    
    Here is my entry
    
    Good bye
    
    "
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing a webcam program (like in Facebook's profile picture) in AS3 and
I'm currently writing a TYPO3 extension which is configured with a list of tt_content
I'm currently writing a tag cloud system. So I wrote the following sql schema
I'm currently writing a program to shut down a computer when over a period
I'm currently writing a Django template template tag, and I would like to be
Background I am currently writing a function which needs to accept a command as
I'm currently writing a document in markdown and I'd like to make a reference
I'm currently writing a graphical sudoku solver program in Java using Swing/Awt. So I
I'm am currently writing a program that calculates the digits of pi, and I
I'm currently writing an custom control which has to hold child control and have

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.