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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:31:50+00:00 2026-06-09T13:31:50+00:00

I have a program where I have two arrays throughout. They begin empty but

  • 0

I have a program where I have two arrays throughout. They begin empty but through the program they get populated.

If this is my first function:

program():-
  populate_arrays([],[]),
  carry_on().

In order to pass my populated arrays into carry_on() must I have four parameters in populate_arrays()? Two to declare the arrays as empty upon starting and another two to pass into carry_on()?

So like:

program():-
  populate_arrays([],[],A,B),
  carry_on(A,B).

it seems awkward I have to double my parameters

  • 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-09T13:31:52+00:00Added an answer on June 9, 2026 at 1:31 pm

    Yes, this is what you do. And no, it is not awkward because these are not duplicates: the first pair is your input arguments, and the second pair is your output results.

    This is a common use pattern, corresponding to state transformation: old in, new out. The state of your knowledge is changed by this predicate, populate_arrays. This is reflected in how you use it.

    BTW, if the starting values are always [], you can provide a “wrapper” for your “working” predicate:

    populate_arrays( A, B):-
       populate_arrays([], [], A, B).
    
    populate_arrays( A, B, C, D):-
       % your implementation ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program with two methods. The first method takes two arrays as
I have two arrays, N and M. they are both arbitrarily sized, though N
I'm trying to multiply two matrices stored inside 1d arrays. I'm using this function,
I have a program that compares two files. I ran visual studio analysis and
In my program I have two classes: Collector and Entity. Collector stores Entities in
I have a basic program that compares two strings : #include <string> #include <iostream>
I have a program that generates/'rolls' two dice. I would like to output these
I have a program where I am generating two double numbers by adding several
I have a program that compares variables from two structs and sets a bit
I have a program where I want to draw a line between two points.

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.