1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Artyom0805 [142]
3 years ago
10

Define a function in Scheme (or relation in Prolog) that checks whether a set of elements (represented as a list) is a subset of

another set (represented as a list).
Computers and Technology
1 answer:
mafiozo [28]3 years ago
4 0

Answer:

subset([],[]).

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

           subset(L,S).

       subset(L, [_|S]) :-

           subset(L,S).

Success:

     subset([1,3], [1,2,3]).

     subset(X, [1,3,4]).        % error handling to compare sets in a given order

Fail:

     subset([2,1], [1,2,3]).   % compares in a different order from the first.

Explanation:

The function "Subset" in the source code above accepts two sets, then checks if the first set is a subset of the second. The code returns true if the condition is met.

You might be interested in
Although architects frequently do most of their work in an office, what might motivate an architect to work from the jobsite?
geniusboy [140]

The <u>on-site problems motivate</u> an architect to work from the jobsite

Explanation:

<u>Architects </u>spend most  of their time working in the  offices,meeting clients , architects and project engineers,they also develop reports and drawings in the office.

An <u>architect </u>visits the job-site as a part of a their job because they are aware of the on-site problems and their guidance is required by the engineering staff to deal with such problems and also continuous monitoring is also required

8 0
3 years ago
Which command group does a user need to access the Formula dialog box?
lesya692 [45]

Answer:

The answer is Data

Explanation:

8 0
3 years ago
use c , c, java or python (any one) programming language for the following programming exercises. do not call built-in library f
Karo-lina-s [1.5K]

A function that receives a string containing a 32-bit hexadecimal integer. the function must return the decimal integer value of the hexadecimal integer.

<h3>The C++ Program</h3>

#include<iostream>

#include <cstring>

#include <string>

using namespace std;

int getDecimalForm(string);

int main() {

 // string binary;

 // Reads both 0 and B as int 48 while B should be

 string hexadecimal = "01F12EBA";

 int decimalForm;

 int re = hexadecimal[0], te = hexadecimal[1];

 /*cout << "Input an eight digit binary string of 1s and 0s to find the integer

 value in decimal form:\n"; cin >> binary;

 // Input validation

 while (binary.size() != 8 || ((binary[0] != '0' && binary[0] != '1')

 || (binary[1] != '0' && binary[1] != '1') || (binary[2] != '0' && binary[2] !=

 '1')

 || (binary[3] != '0' && binary[3] != '1') || (binary[4] != '0' && binary[4] !=

 '1')

 || (binary[5] != '0' && binary[5] != '1') || (binary[6] != '0' && binary[6] !=

 '1')

 || (binary[7] != '0' && binary[7] != '1')))

 {

 cout << "Input a valid eight digit binary string of only ones and zeros\n";

 cin >> binary;

 }*/

 cout << "The 32-bit binary integer value is " << hexadecimal << endl;

 cout << re << " " << te << " " << hexadecimal[0] - 55 << endl;

 decimalForm = getDecimalForm(hexadecimal);

 cout << endl

      << decimalForm << " is the same integer value expressed in decimal form";

}

// a function in C++ that receives a string containing a 16 - bit binary integer

int getDecimalForm(string hStr) {

 int value, num = 1, total = 0, exponent = 0;

 // Made adding happen starting from the right side

 for (int i = (hStr.size() - 1); i >= 0; i--) {

   if ('0' <= hStr[i] <= '9') {

     cout << hStr[i] << " cat\n";

    if (exponent != 0) {

       for (int j = 0; j < exponent; j++) {

         num *= 16;

       }

     }

     value = num * (hStr[i] - 48);

   }

   if ('A' <= hStr[i] <= 'F') {

     cout << hStr[i] << " dog\n";

     if (exponent != 0) {

       for (int j = 0; j < exponent; j++) {

         num *= 16;

       }

     }

     value = num * (hStr[i] - 55);

   }

   // Keep adding the value of the binary integer

   total += value;

   num = 1;

   exponent++;

 }

 return total;

}


Read more about C++ program here:

brainly.com/question/20339175

#SPJ1

3 0
1 year ago
Under which menu option of a word processing program does a star appear?
Citrus2011 [14]

A callout is a type of text box that also includes a line for pointing to any location on the document. A callout appears under the SHAPES <span>menu of the word processing program. The answer that completes this statement is the word "shapes". Hope this answers your question. </span>
3 0
3 years ago
Read 2 more answers
A(n) _____ is any hardware component that allows you to enter data and instructions into a computer or mobile device.
Darya [45]
Hello there.

<span>A(n) _____ is any hardware component that allows you to enter data and instructions into a computer or mobile device.

</span><span>Input Device</span>
4 0
3 years ago
Other questions:
  • One governing factor when determining the minimum size of conduit to be used is the 
    9·2 answers
  • Why is it critical to provide proper treatment for minor and moderate sports injuries within the first 48 hours after sustaining
    14·1 answer
  • Write the 8-bit signed-magnitude, two's complement, and ones' complement representations for each decimal number: +25, + 120, +
    11·1 answer
  • Choose the false statement below. The content that displays in the browser is contained in the head section. The content that di
    14·1 answer
  • Damian uses a modem to connect to a dial-up network. Which statements are true of a modem?
    11·2 answers
  • What is different between a pc mouse and a real mouse
    12·2 answers
  • JAVA
    14·1 answer
  • Jabari created new video game for his coding course. What is one way he should format his pseudocode?
    12·1 answer
  • A company has employees who write down passwords, which should be kept private, on sticky notes. Given this scenario, what shoul
    12·1 answer
  • What search operator would you use with the word "Android" to find Android phone, Android smartphone, and Android cell phone?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!