······@rocketmail.com (Hank B.) writes:
> This is the error:
>
> > (load 'choosepit3.lsp)
> ;; Loading file /home/ma/a/belisle/lisp/choosepit3.lsp ...
> *** - code contains a dotted list, ending with FORMAT
> 1. Break>
>
>
> This is the code:
>
> ;;choose a pit code.
>
> (defun choosePit (chosenPit)
> (cond
> format t "Enter a pit number: ")
You're missing something above here. Some open parens anyway.
The error message is telling you that a COND clause is a non-list, in
this case it's the symbol FORMAT because your parens are misbalanced.
> (setf chosenPit(read))
> (cond
> ;;if the user inputs a number below 1 or larger than 6 say "Not
> ;;a valid pit number. Try again."
>
> ((and (< 6 chosenPit) (> 0 chosenPit)) chosenPit)
> (format t "Not a valid pit. Try again."
> (t (print "Not a valid pit. Try again.") -1 nil ?)
> )
> )
> (setq pits (spread pits chosenPit))
> (defun showgame (pits)
Don't put a defun inside a defun.
> (let (
> (playerone (car pits)) (captureone (cadr pits))
> (playertwo (caddr pits)) (capturetwo(cadddr pits))
> )
> )
> (format t "~8T~a~4T~a~4t~a~4T~a~4T~a~4T~a~%")
> (format t "~8T~1~4T~2~4t~3~4T4a~4T~5~4T~6~%")
> )
> )
This code is VERY badl indented.
Never put any code that is in a sublist of a "(" to the left of that paren.
For example (though there are a lot of such violations I could point to):
(let (
(playerone ...) ...) ...)
should never happen. Only
(let (
(playerone ...))
^
this paren should never be to the left of the one immediately
outside it (end of the "let" line)
...)
etc.