I started to learn Lisp and using Lispworks personal edition 6.1.1 and I hit on problem when evaluating basic functions. I am able to get them right in Scheme but they are not working when I try to evaluate them in Lisp.
I know in Lisp that every symbol has two namespaces. So I tried to write simple procedure for composing two procedures. It is working perfectly in Scheme but in Lisp there is a problem with evaluation.
Code in scheme it is working perfectly and return 2
(define (comp a b)
(lambda (x)
(a (b x))))
(define test (comp car cdr))
(test '(1 2 3))
Same code rewritten in Lisp
(defun comp (a b)
(lambda (x)
(funcall a (funcall b x))))
(defun test (comp #'car #'cdr))
(funcall test '(1 2 3))
Error in lispworks is:
Trying to bind a non-symbol,
(FUNCTION CAR)
.
so when I try to evaluate (defun test (comp #'car #'cdr))
in listener I get
Non-symbol
(FUNCTION CAR)
used as variable name in functionTEST
.
I do not understand why it is not working written like that. I would aprreciate any help