Whaddaya mean it's not a symbol?
Posted: Mon May 30, 2011 2:57 pm
'K, so I'm a rather amateur Lisper (with years of experience in C), and I'm writing a short, simple text-based RPG based on the popular Latin textbook Ecce Romani. The context isn't important, though.
In my quasiquoted *nodes* variable I have a function that checks whether an event has happened (t is consed to the list after the event in my global variable once it happens):
(go ahead and yell at me about superfluous parentheses; I'm paranoid)
The problem is that in testing this out in clisp, I get an error that the first argument is not a function name, and that I should try using a variable instead (or if I neglect to put an apostrophe in front of it, that it's not a function). I've tried this every which way; I've even tried changing the definitions in the argument of the definition of the function itself. Here's a list of things that don't work:
In my quasiquoted *nodes* variable I have a function that checks whether an event has happened (t is consed to the list after the event in my global variable once it happens):
Code: Select all
(defparameter *evnts* '((cubicula1 ((event2 ())))
(horto ((event1 ())))
(rivum ((event3 ())))
(cirmax ((event4 ()) (event6 ())))
(lectus ((event5 ())))))
(defun if-event (locvar num address decrement) ;; Didn't feel like writing this out every time I called it… also writing this occupies my time.
(if (nth num (cdr (assoc (locvar *evnts*)))) (address) (decrement)))
The problem is that in testing this out in clisp, I get an error that the first argument is not a function name, and that I should try using a variable instead (or if I neglect to put an apostrophe in front of it, that it's not a function). I've tried this every which way; I've even tried changing the definitions in the argument of the definition of the function itself. Here's a list of things that don't work:
Code: Select all
(if-event ('horto 0 '(There is now a guy with the letters "F-U-G" branded on his forehead.) '(There is nobody here.)))
(if-event ('(horto) 0 '(There is now a guy with the letters "F-U-G" branded on his forehead.) '(There is nobody here.)))
(if-event (horto 0 '(There is now a guy with the letters "F-U-G" branded on his forehead.) '(There is nobody here.)))
(defun if-event ('locvar num 'address 'decrement) ;; Didn't feel like writing this out every time I called it… also writing this occupies my time.
(if (nth num (cdr (assoc (locvar *evnts*)))) (address) (decrement)))