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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:19:31+00:00 2026-06-05T18:19:31+00:00

At some point of my program I have an atom formed by what previously

  • 0

At some point of my program I have an atom formed by what previously were also atoms, and I want to remove the character spaces within it so that later I can use without any problem:

term_to_atom(Result, 'second2(second2),region(ºMediterranean Sea),months(no_value),third3(third3),recog(ºNew Type),distance(no_value)').

and obtain this

Result = (second2(second2), region(ºMediterraneanSea), months(no_value), third3(third3), recog(ºNewType), distance(no_value))

or also the original would work

Result = (second2(second2), region(ºMediterranean Sea), months(no_value), third3(third3), recog(ºNew Type), distance(no_value))

because if I don’t delete those character spaces then term_to_atom will complain about it. How can I solve it?

  • 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-06-05T18:19:33+00:00Added an answer on June 5, 2026 at 6:19 pm

    You can use this procedure:

    strip_spaces(S, NoSpaces) :-
       atom_codes(S, Cs), delete(Cs, 0' , X), atom_codes(NoSpaces, X).
    

    but delete/3 is deprecated. Another possibility is

    strip_spaces(S, NoSpaces) :-
        atomic_list_concat(L, ' ', S),
        atomic_list_concat(L, NoSpaces).
    

    Either of these will ‘eat’ each space, but from your problem description, in comments you exchanged with gusbro, this doesn’t seems to me the right way to go. Changing the literals seems at DB interface could ask for trouble later.

    Parsing your input to a list, instead of a conjunction, can be done with DCGs:

    :- [library(http/dcg_basics)].
    
    parse_result(X, R) :-
        atom_codes(X, Cs),
        phrase(parse_list(R), Cs).
    parse_list([T|Ts]) -->
        parse_term(T), (",", parse_list(Ts) ; {Ts=[]}).
    parse_term(T) -->
        string(F), "(", string(Arg), ")",
        {atom_codes(Fa,F), atom_codes(Arga,Arg), T =.. [Fa,Arga]}.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a clojure program that at some point executes a function called db-rebuild-files-table
I have a program that occasionally needs to scan some directories recursively (an improvement
Suppose that I have a Java program within an IDE (Eclipse in this case).
At some point in an XSLT program, I have the following: <xsl:for-each select=tags/tag> <xsl:apply-templates
I have a C application that embeds the Python 2.7 interpreter. At some point
I wrote a nice little program. At some point, it is required to load
I'm developing a program that makes some floating points calculations. Is there any way
I'm doing some random experimentation and want to print out the address the program
At some point Find All References feature got broken for a single solution that
At some point I must have moved files from one location to another using

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.