I'm new here as you can see from this being my first post. I'm a college student and am currently taking a computational psychology course. We started covering the basics of Lisp and I felt pretty comfortable and knew my way around. However, I'm running into some difficulty here and there. I'm not sure if this post will be considered okay, but I'll give it a try.

Here are some of the functions I have to define as well as where I'm at. I might be going the wrong way.. but hopefully you guys can nudge me to the right direction.

1. Use mapcar and lambda to define (add-to-list x lst) which adds the number x to each of a list of numbers and returns the list of results in the same order.

Code: Select all

```
(defun add-to-list (x lst)
"(x lst)
Adds the number x to each of a list of numbers and returns the list of results in the same order"
(mapcar (lambda (a b) (+ a b)) '(x x x x x x x) '(lst)))
```

2.Use do, if, oddp, and return to define (first-odd lst) which returns the first odd integer in a list of integers or â€˜none if none are odd.

Code: Select all

```
(defun first-odd (lst)
"(lst)
Returns the first odd integer in a list of integers or â€˜none if none are odd."
(if (do ((numbers lst (cdr numbers))
(odd (first lst) (oddp (car numbers))))
((null numbers) odd)) odd 'none))
```

So yea, these are some of the problems I'm having some difficulty with. Any help would be immensely appreciated. And if this is an inappropriate post, I'm very sorry.