Reputation: 29
I problem I'm running into is that when I make a function that prints a certain part of a list it prints it as NIL and not the actual element(s).
Ex:
> (setf thelist '((a b) (c (d e f)) (g (h i)))
> (defun f1(list)
(print ( car (list))))
> (f1 thelist)
NIL
NIL
But this works:
> (car thelist)
(A B)
Upvotes: 0
Views: 334
Reputation: 223023
You have:
(print (car (list)))
This is invoking the list
function, and not using your list
parameter. (list)
always returns an empty list. (Common Lisp is a "Lisp-2", which means that list
in a function-call context refers to a different thing from list
in a variable-access context.)
To fix, change your code to use:
(print (car list))
instead.
Upvotes: 11