Search code examples
lispcommon-lisp

Correct usage of destructuring-bind


I'm experimenting with destructuring-bind as follows:

(destructuring-bind
           (a  b) '(1  2) (list a b)))

When I evaluate this in the REPL I get:

READ from #1=#<INPUT STRING-INPUT-STREAM>: an object cannot start with #\)
   [Condition of type SYSTEM::SIMPLE-READER-ERROR]

I expected the result to be

(1 2)

The error doesn't mean anything to me, in the context of the code above.

I realise that I'm just binding a simple list of arguments, rather than a tree, but I still expecteded this to work. Any clues as to where I've gone wrong?


Solution

  • Remove the extra ) on the end. Works fine.