Essential Info:
GNU CLISP interpreter version 2.31
Windows 2000 environment
The following two examples work as I would expect:
15. Break [22]> (first '(first (rest (rest ( (a b) (c d) (e f) ) ) ) ) )
FIRST
15. Break [22]> (first (first (rest '(rest ( (a b) (c d) (e f) ) ) ) ) )
(A B)
But the following example produces the following error:
15. Break [22]> (first (first '(rest (rest ( (a b) (c d) (e f) ) ) ) ) )
** - Continuable Error
FIRST: REST is not a LIST
If you continue (by typing 'continue'): Retry
The following restarts are also available:
STORE-VALUE :R1 You may input a new value for (FDEFINITION 'A).
USE-VALUE :R2 You may input a value to be used instead of
(FDEFINITION 'A).
STORE-VALUE :R3 You may input a new value for REST.
USE-VALUE :R4 You may input a value to be used instead of REST.
USE-VALUE :R5 You may input a value to be used instead.
USE-VALUE :R6 You may input a value to be used instead.
STORE-VALUE :R7 You may input a new value for FIRST.
USE-VALUE :R8 You may input a value to be used instead of FIRST.
STORE-VALUE :R9 You may input a new value for FIRST.
USE-VALUE :R10 You may input a value to be used instead of FIRST.
CONTINUE :R11 Retry
STORE-VALUE :R12 You may input a new value for (FDEFINITION
'FRIENDS).
USE-VALUE :R13 You may input a value to be used instead of
(FDEFINITION 'FRIENDS).
Is this a interpreter bug, or am I not fully understanding LISP nesting?
Thank you for any insight you may share,
Todd English
Hi todd english,
> (first (first '(rest (rest ((a b) (c d) (e f))))))
You are quoting this object:
(rest (rest ((a b) (c d) (e f))))
Let's call the object OBJ.
Thus you are evaluating:
(first (first OBJ))
Now (first OBJ) => rest
Do you now see the problem? You can't find the first element of a symbol!
Regards,
Adam