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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:32:52+00:00 2026-05-25T18:32:52+00:00

In visual lisp, you can use (atoi 123) to convert 123 to 123 .

  • 0

In visual lisp, you can use (atoi "123") to convert "123" to 123. It seems there is no “atoi” like function in clisp ?

any suggestion is appreciated !


Now i want to convert '(1 2 3 20 30) to "1 2 3 20 30", then what’s the best way to do it ?

parse-interger can convert string to integer, and how to convert integer to string ? Do i need to use format function ?

(map 'list #'(lambda (x) (format nil "~D" x)) '(1 2 3)) => ("1" "2" "3")

But i donot know how to cnovert it to "1 2 3" as haskell does:

concat $ intersperse " " ["1","2","3","4","5"] => "1 2 3 4 5"

Sincerely!

  • 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-25T18:32:53+00:00Added an answer on May 25, 2026 at 6:32 pm

    In Common Lisp, you can use the read-from-string function for this purpose:

    > (read-from-string "123")
    123 ;
    3
    

    As you can see, the primary return value is the object read, which in this case happens to be an integer. The second value—the position—is harder to explain, but here it indicates the next would-be character in the string that would need to be read next on a subsequent call to a reading function consuming the same input.

    Note that read-from-string is obviously not tailored just for reading integers. For that, you can turn to the parse-integer function. Its interface is similar to read-from-string:

    > (parse-integer "123")
    123 ;
    3
    

    Given that you were asking for an analogue to atoi, the parse-integer function is the more appropriate choice.


    Addressing the second part of your question, post-editing, you can interleave (or “intersperse”) a string with the format function. This example hard-codes a single space character as the separating string, using the format iteration control directives ~{ (start), ~} (end), and ~^ (terminate if remaining input is empty):

    > (format nil "Interleaved: ~{~S~^ ~}." '(1 2 3))
    "Interleaved: 1 2 3."
    

    Loosely translated, the format string says,

    For each item in the input list (~{), print the item by its normal conversion (~S). If no items remain, stop the iteration (~^). Otherwise, print a space, and then repeat the process with the next item (~}).

    If you want to avoid hard-coding the single space there, and accept the separator string as a separately-supplied value, there are a few ways to do that. It’s not clear whether you require that much flexibility here.

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

Sidebar

Related Questions

Visual studio seems intent that my javascript code is bad, mostly because it has
Visual Studio Team system 2008 crashes without any error messages whenever I try to
Visual Studio 2008 insists on indenting HTML like this: <h1> title</h1> <h2> subtitle</h2> where
Visual studio keeps including sourceannotations.h to my C++ projects. This file seems to be
Visual Studio 2010 seems to insist on having this import in web application projects
Visual Studio 2008 SP1 doesn't provide any language pack prerequisite for the .NET Framework
Visual Studio 2008 has a test type called a Load Test. It looks like
Visual studio is just hanging. The GUI just sits there and the CPU is
Visual studio has a built-in unit test framework. I am wondering if I can
Visual Studio 2012 (and earlier versions) provide predefined #defines so that source code can

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.