Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I am learning LISP by Emacs. I have a question. Here is the example: I see the number 4 plus the list (1 2

Hi, I am learning LISP by Emacs. I have a question.

Here is the example:

image text in transcribed

I see the number 4 plus the list (1 2 3 4 5) = ( 5 6 7 8 9)

But please help me fix the code, how can two lists addition.

Ex: (add-to-list '(1 1 1 1 1) '(1 2 3 4 5))

(2 3 4 5 6)

[1]> (defun add-to-list (val list-of-numbers) (mapcar #'(lambda (num) (+ val num)) list-of-numbers)) ADD-TO-LIST [2]> (add-to-list 4 (1 2 3 4 5)) (5 6 7 8 9)

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_2

Step: 3

blur-text-image_step3

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

ISBN: 133544613, 978-0133544619

Students also viewed these Databases questions

Question

2 What supply is and what affects it.

Answered: 1 week ago