Question
1. Start Allegro CL In the Debug Window you will see the following prompt: CG-USER(1): 2. Enter the following text: (defun hello () (write-string Hello,
1. Start Allegro CL In the Debug Window you will see the following prompt: CG-USER(1):
2. Enter the following text: (defun hello () (write-string "Hello, Everyone!")) You should then see the following: HELLO CL-USER(2):
3. (5 points) Run your function by entering: (hello) Hopefully you will see the following in the window: Hello, Everyone! "Hello, Everyone! CL-USER(3):
4. Create and run the following functions in the Debug Window. Do not close the Debug Window yet.
a. goodbye: It should print bye, good bye, farewell or some other word.
b. middle-name: Accepts a full name as an argument and returns the middle name. This name can be represented as a list. For example, if you execute the program by entering (middle-name (Mary Jane Doe)) the output should be Jane.
c. second-of-second: Accepts a list of lists as an argument and returns the second element of the second list. For example, if you run the function by entering (second-of-second ((a b c) (1 x) (e f))) the output should be x.
d. repeater: You have the option of 1) printing the text of our choice a set number of times or 2) letting the user specify the number of times to print the text in an argument. You will receive more points for level of effort if you successfully complete the second option.
1. Suppose you create the function to print the text AI three times and execute it by running (repeater). The output should be:
1. AI
2. AI
3. AI
2. If the function accepts arguments one should be able to execute it by entering (repeater x), where x is an integer. Entering (repeater 4) should produce this output:
1. AI
2. AI
3. AI
4. AI
e. (15 points) adder: Prompts the user to enter 4 numbers and print the sum to the console. To run this function, one should only have to enter (adder). If you cannot successfully prompt the user for the numbers, the function can accept four arguments and print the sum. You cannot receive full credit for successful level of effort.
5. Save your Debug Window output to a file called Week2- by selecting File | Save. Example: If your last name is Walker the file should be called Week2-Walker. Place this file in the Week2: Homework Dropbox.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started