Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Common Lisp create the following functions a. goodbye : It should print “b

ID: 3603122 • Letter: U

Question

Using Common Lisp create the following functions

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.

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

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.

Explanation / Answer

(boundp 'foo) NIL * (fboundp 'foo) NIL * (defparameter foo 42) FOO * foo 42 * (boundp 'foo) T * (fboundp 'foo) NIL * (defun foo (x) (* x x)) FOO * (fboundp 'foo) T * foo ;;; *** 42 * (foo 3) ;;; +++ 9 * (foo foo) 1764 * (function foo) # * #'foo # * (let ((+ 3)) (+ + +)) 6
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote