Computers and Technology
07.10.2020 13:36
138
497
6
Solved by an expert

Assume that you have member/2 where member(X, Y) checks whether X is an element

Assume that you have member/2 where member(X, Y) checks whether X is an element of a list Y. Complete the first clause of the following Prolog program subset/2 where subset(A, B) will establish a relationship of A being a subset of B. subset([X|R],S) :- %% the body should be... subset([ ],_).
Show Answers
alysonmariefont
alysonmariefont
4,7(33 marks)

Refer below.

Explanation:

Assume that you have member/2 where member(X, Y) checks whether X is an element of a list Y. Complete the first clause of the following Prolog program subset/2 where subset(A, B) will establish a relationship of A being a subset of B. subset([X|R],S) :- %% the body should be... subset([ ],_).

subset([X|R],S) :-

subset([ ],_).

member(X,S), subset(R,S)

aahneise02
aahneise02
4,4(57 marks)

These are the supplies in the list:  

[‘pencil’, ‘notebook’, ‘backpack’, ‘pen’, ‘calculator’]

Explanation:

The line return (\n) character will be in the output (so there will be a change of line), but it will NOT be visible as it would have been interpreted as a special character.

So the output will be on 2 different lines, with no \n visible.

If the command would have been: print('These are the supplies in the list:\n', supplies), with single quotes (') instead of double quotes (") then then \n would have been printed but not interpreted as a special character.  At least in most computer language.  Since we don't know of which language the question refers to, we can't be sure at 100%.

Popular Questions about the subject: Computers and Technology

If costs are recorded as 8-bit numbers in a 50-router network,...
Computers and Technology
04.11.2020 06:51
Astudent is recording a song on her computer. when the recording...
Computers and Technology
14.04.2020 13:46
Write the definition of a function printlarger, which has two...
Computers and Technology
23.01.2023 12:16
Fred has just added dsl service at his home, with a separate...
Computers and Technology
17.11.2021 01:56
Emily loves her job as an executive recruiter for a large hospital...
Computers and Technology
24.07.2021 15:00
What s the purpose of maintaining a network of digital forensics...
Computers and Technology
20.01.2023 11:48
Choose legitimate reasons why the rdbms caches data and other...
Computers and Technology
21.04.2020 11:29
What is the technique used to divide information sets into mutually...
Computers and Technology
10.03.2022 06:19
Distributed computing is a term that describes the work that...
Computers and Technology
21.03.2023 11:53
Danelle wants to use a stylus on her laptop but does not have...
Computers and Technology
30.11.2021 04:29

New questions by subject

What mass of water will absorb 1863 Joules of energy when it...
Chemistry
03.04.2022 00:55
Which amendment of the constitution give people the right to...
Law
08.12.2021 20:31
3. Which of the divisions of vascular plants has more members?...
Biology
09.08.2020 06:15
#
#
#
#
# #

We expand our knowledge with many expert answers