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
let, rather thanlet*- you are not using the definitions in each other.let*(could it be, that you've redefined it somewhere?)diag, but yes - it should be valid, which is why I suggested trying let.