Reputation: 8678
Basically I tried evaluating the function below but keep getting the following error:
WARNING :
MAINDIA is neither declared nor bound,
it will be treated as if it were declared SPECIAL.
WARNING :
SOUT is neither declared nor bound,
it will be treated as if it were declared SPECIAL.
WARNING :
NORT is neither declared nor bound,
it will be treated as if it were declared SPECIAL.
*** - NIL: variable MAINDIA has no value
The following restarts are available:
ABORT :R1 Abort debug loop
ABORT :R2 Abort debug loop
ABORT :R3 Abort debug loop
ABORT :R4 Abort debug loop
ABORT :R5 Abort debug loop
ABORT :R6 Abort debug loop
ABORT :R7 Abort debug loop
ABORT :R8 Abort main loop
When I tried copy and paste an example from the internet it works, but when I manually type it into the interpreter it doesn't work. Also, I am running CLISP from emacs.
Code:
(defun diagonal-mast (sq)
(let* ((maindia #x8040201008040201)
(diag (- (* 8 (logand sq 7))
(logand sq 56)))
(nort (logand (- diag)
(ash diag -31)))
(sout (logand diag (ash (- diag) -31))))
(ash (ash maindia (- sout))
nort)))
NOte: I am on CLISP 2.48
Upvotes: 0
Views: 393
Reputation: 769
In all likelihood, your problem is with emacs, not with the code, because it's running fine in the commenters' and my lisps. I'm not on emacs anymore, so it's possible the following solution is deprecated or entirely false, but if you start Emacs via emacs --debug-init and get an error message, you've got some setup issue rather than a code issue. Elsewise, it seems like your lisp implementation is the problem, not your lisp writing. If it's somehow your lisp implementation, just rebuild and it should be fine. If it's your setup, i'm pretty sure slimedev has some a pretty exhaustive list of bugs and fixes. Good hunting.
Upvotes: 1