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
Brums [2.3K]
3 years ago
13

Write a Common Lisp predicate function that tests for the structural equality of two given lists. Two lists are structurally equ

al if they have the same list structure, although their atoms may be different. A script of defining and testing the function in Clisp on the empress system must be submitted.
Computers and Technology
1 answer:
zysi [14]3 years ago
6 0

Answer:

Explanation:

For the Program plan:

1. Two lists are structurally equal if they have the same list structure, although their atoms may be different.

2. So we are going to write a function that will check if elements in both lists at same position are atoms or not.

3. If yes then it should return true else false.

Program:

#lang scheme

( define (structurally-equal list1 list2)

(cond ((and (null? list1) (null? list2)) #t)

((or (null? list1) (null? list2)) #f)

((and (atom? (car list1)) (atom? (car list2)))

(structurally-equal (cdr list1) (cdr list2)))

((or (atom? (car list1)) (atom? (car list2))) #f)

(else (and (structurally-equal (car list1) (car list2))

(structurally-equal (cdr list1) (cdr list2) )))))

( define (atom? x) (not (or (pair? x) (null? x))))

You might be interested in
Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs, or 45 cents for individual
svp [43]

Answer:

Explanation:

import java.Util;

public class Eggs{

public static void main (String [] args)

{

int noOfEggs, dozen, units;

float total;

Scanner input = new Scanner(System.in);

noOfEggs = input.nextInt();

if(noOfEggs < 0)

{

System.out.print("Invalid");

}

else

{

if(noOfEggs >= 12)

{

dozen = noOfEggs/12;

units = noOfEggs % 12;

}

else

{

dozen = 0;

units = noOfEggs;

}

total = dozen * 3.25 + (units * 45)/100;

System.out.print("You ordered "+noOfEggs+" eggs.\n");

System.out.print("That's "+dozen+" dozen at $3.25 per dozen and "+units+" loose eggs at 45 cents each for a total of $"+total);

}

}

}

7 0
3 years ago
Al and Bill are arguing about the performance of their sorting algorithms. Al claims that his O(N log N)-time algorithm is alway
lisabon 2012 [21]

Answer:

See in Explanation

Explanation:

All you know is that an O(n log n) algorithm is eventually (a lot) faster than an O(n^{2} ) algorithm, but for any specific value of n, you can't say anything. Indeed, the asymptotic growth of the function doesn't depend on its value on n. This means that if  f(n)=O(n^{2} ) then for all c_{1} ,....\ , c_{99}, the following function is also O(n^{2} ):

f^{'} (n)=[\ cnf(n)\  if \ n

So asymptotic notation is completely uninformative regarding the performance of algorithms on specific values of n.

You could say that functions such as f^{'}(n) are artificial and never really occur in practice. This is not quite true (you can hard-code some auxiliary information for small n, for example), but even if you consider "natural" functions, asymptotic notation doesn't help you to determine anything other than asymptotic's: consider for example n^{2} against 10^{100}n\  log \ n (such examples definitely happen in practice, for example in fast matrix multiplication).

7 0
3 years ago
The permissions of a file in a Linux system are split into three sets of three permissions: read, write, and execute for the own
Reptile [31]

Answer:

Explanation:

def octal_to_string(octal):

   result = ''

   value_letters = [(4, 'r'), (2, 'w'), (1, 'x')]

   for c in [int(n) for n in str(octal)]:

       for value, letter in value_letters:

           if c >= value:

               result += letter

               c -= value

           else:

               result += '-'

   return result

print(octal_to_string(755))

print(octal_to_string(644))

print(octal_to_string(750))

print(octal_to_string(600))

**************************************************

7 0
3 years ago
If you could create a social network, what would it be like? What would make it so special about the others? (If you want you ca
patriot [66]
Be able to contact and connect with other users. be able to share what your doing.
7 0
4 years ago
After hacking into atm systems remotely using a laptop, What attacker worked with the atm manufacturers to resolve the identifie
Aneli [31]

grey hat hackers are those after hacking into ATM systems remotely using a laptop, works with the ATM manufacturers to resolve the identified security vulnerabilities

  • A grey hat hacker is simply known as an hacker that falls between the range of black and white hacker. They are known to illegally break into systems so as to show off their skills to the administrator of the system they penetrated or to seek to sell their services in repairing security breaches.

  • In the ATM case, they attacked it and then also want the ATM manufacturer to use their service.

Conclusively we can therefore say that the hacker was a gray hat hacker.

Learn more from

brainly.com/question/15899195

3 0
3 years ago
Other questions:
  • ______is a multimodal application software platform. the centrealized and shared database system ties the entire organization to
    14·1 answer
  • What is the first thing you should do when creating a spreadsheet
    5·1 answer
  • In the Dread Pirate Roberts case, U.S. Ulbricht, 31 F. Supp. 3D 54D (S.D.N.Y. 2014), one of the issues that the court addressed
    10·1 answer
  • Pinterest, a visual bookmarking Website, logs more than 14 terabytes of new data each day, which means its storage needs are con
    10·1 answer
  • If a CPU receives theinstruction to multiply the byte-sized values $12 and $3E, thisaction will take place in the ______________
    13·1 answer
  • Which precaution should you take while working on a computer
    9·1 answer
  • What kinds of objects might benefit from the use of the Loop Cut and Slide tool, and why? In your own words, how does edge loop
    14·1 answer
  • write an algorithm and draw a flowchart to calculate the sum of of the first 10 natural numbers starting from 1​
    13·1 answer
  • Create a high-level plan to perform a gap analysis for Fullsoft Inc
    7·1 answer
  • Which of the following is an example of a directory path? Check all of the boxes that apply.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!