1

I've defined the following function soma-n where n is an integer and l is a list.

(defun soma-n (n l)
  (if (null l)
      ()
      (cons (+ (first l) n) (soma-n (rest l)))))

I'm trying to call it as follows, but it seems that one of the arguments is not sent, since I'm getting the following error:

(soma-n 3 '(1 2 3))
; SOMA-N got 1 arg, wanted at least 2.

What is the problem with the way I'm calling the function?

0

1 Answer 1

4

this is what you probably wanted

(defun soma-n (n l)
  (if (null l)
      ()
      (cons (+ (first l) n) (soma-n n (rest l)))))

you were passing just a list to recursive call of some-n

Sign up to request clarification or add additional context in comments.

1 Comment

ahh, I miss that one thanks a lot!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.