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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:07:59+00:00 2026-05-28T03:07:59+00:00

I have the predicate m(L,L) and I want it to return the list that

  • 0

I have the predicate m(L,L) and I want it to return the list that it takes.
The code is this :

m([],[]).
m([H|T],[H|L]) :- m(T,L).

When I try to use it with this example :

m([1,2,3,4,5,6,7,8,9,10],L)

I get this as an answer :

L = [1, 2, 3, 4, 5, 6, 7, 8, 9|...].

(I noticed that if I try it with less elements its ok.) why is this happening and the list is unfinished?

How can I avoid this?

Sorry if its a really stupid question but I’ve searched the web and I couldn’t find any documentation that can help me understand…
Thank you!

  • 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-28T03:08:00+00:00Added an answer on May 28, 2026 at 3:08 am

    The list is finished – the output is just getting truncated for visualization purposes. If you write a predicate that prints out your list, you’ll see that it’s complete. I’m guessing you’re using SWI prolog, which means you can check out this link for ways to change the display settings.

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

Sidebar

Related Questions

Hello I have a predicate that returns example equalisation for given list equalisation([1,2,3,4,12],L). L
I'm trying to write a predicate that divides a list into N parts. This
I have a list of objects that I want to filter by an integer
I have a search form that looks like this: The code behind the form
I want to return a String in a list that contains only Digits. I
Getting a bit stuck on this. Basically I have a method that I want
Having a bit of trouble using the List.Find with a custom predicate i have
I want to get a list of all students who were at one of
I have a situation where I want to remove duplicates from a collection (list)
I have some code that I have inherited that generates a matrix of significance

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.