# Common Lisp: List of Lists

Page 1 of 1

## 2 Replies - 1489 Views - Last Post: 19 June 2016 - 05:09 AM

### #1 bperkins

Reputation: 0
• Posts: 4
• Joined: 29-March 15

# Common Lisp: List of Lists

Posted 18 June 2016 - 04:46 PM

I am trying to write a function in LISP that accepts a list of lists as the argument, then returns the second element of the second list. This is what I have for the function definition. When I call the "second-of-second" function, I get this error. Thanks for the help.

```CG-USER(1): (defun second-of-second((x)(y)(z)) (car(cdr y)))

CG-USER(2): (second-of-second '((a b c)(1 x)(e f)))

Error: Non-symbol used as a lambda argument name in function SECOND-OF-SECOND.
[condition type: PROGRAM-ERROR]

```

This post has been edited by sepp2k: 19 June 2016 - 05:01 AM

Is This A Good Question/Topic? 0

## Replies To: Common Lisp: List of Lists

### #2 jon.kiparsky

• Beginner

Reputation: 10980
• Posts: 18,735
• Joined: 19-March 11

## Re: Common Lisp: List of Lists

Posted 18 June 2016 - 06:49 PM

```(defun second-of-second((x)(y)(z)) (car(cdr y)))
```

I would start by defining this function to take a list as its argument

### #3 sepp2k

• D.I.C Lover

Reputation: 2549
• Posts: 4,072
• Joined: 21-June 11

## Re: Common Lisp: List of Lists

Posted 19 June 2016 - 05:09 AM

The parameter list of a function consists of the names of its parameters - one per parameter (ignoring for the moment things like rest, keyword or optional arguments). Anything else (like in your case parentheses) is not allowed, which is what the error message is telling you.

If you want your function to take exactly one argument, the parameter list should contain exactly one name, which should not be surrounded in further parentheses.