Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the following functions in Lisp: a. A function called next-day that takes one parameter that you can assume to be a symbol named after

image text in transcribed

Write the following functions in Lisp: a. A function called next-day that takes one parameter that you can assume to be a symbol named after a day of the week (no need to check it), such as 'monday, and returns the symbol for the next day. For example, (next-day 'tuesday) should return the symbol 'wednesday. Implement this function with a complex conditional. b. A function that generates a random day of the week, then displays a message saying that "Today is ... and tomorrow will be ...". For this purpose, create a global variable before the function containing the days of the week as a list. Then use the built-in function random first to generate a number between 0 and 6 (including). The expression (random) by itself generates a random integer. You can call it with one parameter to return a value within the range from 0 to the value of the parameter-1. For example, (random 10) will return a value between 0 and 9. Next, use the number generated at the previous step to retrieve the symbol for the day of the week from the list. For that you can either copy your own function element-i from the previous homework, or use the built-in elt. Here's an example of a call to elt which evaluates to 3: (elt '(1 2 3 4) 2) ; returns 3 We want the name of the day to appear capitalized. For this, extract the symbol-name of the day first, then apply the built-in function capitalize to it. Use the result in the princ function call, and do the same thing for the next day. Make the function return true (t) instead of the last thing it evaluates, to avoid seeing the message printed more than once

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions

Question

What could motivate staff to participate?

Answered: 1 week ago

Question

Explain the factors affecting dividend policy in detail.

Answered: 1 week ago

Question

Explain walter's model of dividend policy.

Answered: 1 week ago

Question

3. How can policymakers influence a nations saving rate?

Answered: 1 week ago

Question

4. What does growth in total factor productivity measure?

Answered: 1 week ago