This is 'swi-prolog'
% Our database
people(matt,new_york).
people(tom,new_york).
people(bill,new_york).
people(tim,virginia).
people(peggy,north_carolina).
people(jessica,texas).
% recursive function to print the values
print2([]).
print2([H|T]) :-
format('Name = ~w Place = ~w ~n',H),
print2(T).
% if the list is empty than terminate
find_all_people(_, []).
% start of the recursive function
find_all_people(_, [HD|T]) :-
findall([Name, Location], (people(Name, Location),
Location = HD), X), %findall entities where Location = HD
print2(X), %print the name and location matched
find_all_people(_, T). %call the function again and
send the rest of the list
allPeople(Name,Locations):-
findall(Location,people(Name,Location),Locations).
allPeople(X, [X|_])
allPeople(X,[_|Tail]):-
allPeople(X,Tail).
I want to be able to enter location [new_york,texas] and Enter some string when im done entering my input then i want to be able to put my list [new_york,texas] into my find_all_people(_,[new_york,texas]) and print only the names that matches the possibilites.do not do it at the command line i want to make a main be to enter main at the command
Code :-
% Our database
people(matt,new_york).
people(tom,new_york).
people(bill,new_york).
people(tim,virginia).
people(peggy,north_carolina).
people(jessica,texas).
% recursive function to print the values
print2([]).
print2([H|T]) :-
format('Name = ~w Place = ~w ~n',H),
print2(T).
% if the list is empty than terminate
find_all_people(_, []).
% start of the recursive function
find_all_people(_, [HD|T]) :-
findall([Name, Location], (people(Name, Location),
Location = HD), X), %findall entities where Location = HD
print2(X), %print the name and location matched
find_all_people(_, T). %call the function again and
send the rest of the list
Images :-
if you like the answer please VOTE for me
This is 'swi-prolog' % Our database people(matt,new_york). people(tom,new_york). people(bill,new_york). people(tim,virginia). people(peggy,north_carolina). people(jessica,texas). % recursive function to...
Edit a C program based on the surface code(which is after the question's instruction.) that will implement a customer waiting list that might be used by a restaurant. Use the base code to finish the project. When people want to be seated in the restaurant, they give their name and group size to the host/hostess and then wait until those in front of them have been seated. The program must use a linked list to implement the queue-like data structure....
Game Description: Most of you have played a very interesting game “Snake” on your old Nokia phones (Black & White). Now it is your time to create it with more interesting colors and features. When the game is started a snake is controlled by up, down, left and right keys to eat food which appears on random locations. By eating food snake’s length increases one unit and player’s score increases by 5 points. Food disappears after 15 seconds and appears...
Activity: Writing Classes Page 1 of 10 Terminology attribute / state behavior class method header class header instance variable UML class diagram encapsulation client visibility (or access) modifier accessor method mutator method calling method method declaration method invocation return statement parameters constructor Goals By the end of this activity you should be able to do the following: > Create a class with methods that accept parameters and return a value Understand the constructor and the toString method of a class...
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...