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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:23:36+00:00 2026-06-15T08:23:36+00:00

Let say I have a list [[a,b,c],[d,e,f],[g,h,i]] I want to get every consecutive element

  • 0

Let say I have a list
[[a,b,c],[d,e,f],[g,h,i]]

I want to get every consecutive element and put it in another predicate.

func(a,b).
func(b,c).

func(d,e).
func(e,f).

func(g,h).
func(h,i).

I already wrote the predicate I want to put in, but I’m having a hard time getting two elements from the list of lists.

  • 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-15T08:23:37+00:00Added an answer on June 15, 2026 at 8:23 am

    You can try :

    consecutive(L, R) :-
        maplist(create_func, L, RT),
        flatten(RT, R).
    
    create_func([A,B], [func(A,B)]) :- !.
    
    create_func([A,B | T], [func(A,B) | R]) :-
        create_func([B | T], R).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have an index action where I want to get a list
Let say I have a URL: http://java.sun.com/j2se/1.5/pdf I want to get a list of
Let's say I have a list of IDs and I want to see if
Let's say I have a list looking like this: List=[alpha(1,2),beta(3,4),gamma(4,1)] Ok, so I want
I have a list of n words (let's say 26). Now I want to
Let's say I have a list of values to which I want to apply
Let's say I have a list of books I want to render in a
Let's say I have a list and a set and I want to do
Let's say I have a list of values and I have already chunked them
Let's say I have a list of 5 twitter handles and I want to

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.