Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LISP (clisp.cons.org) write a recursive double-odd, MY-DOUBLE-ODD that doubles the odd values and leaves ;; the even values alone ;; ex. (MY-DOUBLE-ODD (1 2 3

LISP (clisp.cons.org)

write a recursive double-odd, MY-DOUBLE-ODD that doubles the odd values and leaves ;; the even values alone ;; ex. (MY-DOUBLE-ODD (1 2 3 4 5 6)) returns => (2 2 6 4 10 6) ;;

I'm unsure as to why this code isn't working.

[1]> (defun MY-DOUBLE-ODD (n1 n2 n3 n4 n5 n6) (if (oddp n1) (setq n1 (* n1 2))) (if (oddp n2) (setq n2 (* n2 2))) (if (oddp n3) (setq n3 (* n3 2))) (if (oddp n4) (setq n4 (* n4 2))) (if (oddp n5) (setq n5 (* n5 2))) (if (oddp n6) (setq n6 (* n6 2))) (printem n1 n2 n3 n4 n5 n6) ) MY-DOUBLE-ODD [2]> (MY-DOUBLE-ODD '(1 2 3 4 5 6))

*** - EVAL/APPLY: Too few arguments (1 instead of at least 6) given to MY-DOUBLE-ODD The following restarts are available: ABORT :R1 Abort main loop Break 1 [3]>

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

Demonstrate how to use the Gaps Model for diagnosing and

Answered: 1 week ago

Question

Differentiate between hard and soft measures of service quality.

Answered: 1 week ago