Reputation: 79
I am trying to write a function lets say A(n)
which is supposed to have a list
(the answer is n)
n being any integer in the list I want when i type (A 4)
it should display (the answer is 4)
I am not sure how to go about it thinking of using setq and the list function
But how to construct it its confusing me I'm just a newbie trying to learn lisp, any ideas or books I can read I will greatly appreciate.
Upvotes: 4
Views: 160
Reputation: 166
Another part of your question is what books to read. Usually people recommend to read the "Practical Common Lisp", a book with a friendly and easy-to-read introduction to the Common Lisp. Then there is the "Getting Started" article on Cliki.net. This should be sufficient to get started with the language.
Upvotes: 0
Reputation: 9217
(defun A (n)
(list 'the 'answer 'is n))
(A 4)
=> (the answer is 4)
Upvotes: 4