Issue with Chapter 6 Wizards Game

54 views
Skip to first unread message

Matt Emmonasd

unread,
May 24, 2012, 1:42:17 PM5/24/12
to land-o...@googlegroups.com
This is seemingly identical to the source code from landoflisp.com for the wizards_game.lisp

However, I continually get these errors when trying to input commands:

[1]> (load "~/lisp/game.lisp")
;; Loading file /Users/matt/lisp/game.lisp ...
;; Loaded file /Users/matt/lisp/game.lisp
T
[2]> (game-repl)
look
*** - MAPCAR: A proper list must not end with LOOK
The following restarts are available:
ABORT          :R1      Abort main loop


I figure there is something wrong with my game-read function. Cannot figure it out. Fairly frustrated.

Cannot identify where errors are (leads me to another question, how do you actually debug this stuff?

I've messed around in Emacs (steep learning curve) and tried LispWorks. Neither really worked out. I've stuck with text editors and load them through terminal. 

Is there a more efficient way to do check for issues? 



Here is my version of the wizards game:


Matt Emmonasd

unread,
May 24, 2012, 1:59:02 PM5/24/12
to land-o...@googlegroups.com
I found one small issue:

(defun game-read ()
    (let ((cmd (read-from-string (concatenate 'string "(" (read-line) ")"))))
         (flet ((quote-it (x)
                    (list 'quote x)))
             (cons (car cmd) (mapcar #'quote-it (cdr cmd))))))

 
the line:
       (cons (car cmd) (mapcar #'quote-it (cdr cmd))))))

previously read:
       (cons (car cmd) (mapcar #'quote-it (car cmd))))))

so its obvious that caused issues.

Mauricio Fernandez

unread,
Jun 2, 2012, 11:12:00 PM6/2/12
to Land of Lisp
About the debugger, I´ve used the SLIME debugger (EMACS) and is quite
powerful, it gives you a lot of information to figure out what might
be wrong, and will allow your to use your own restarts, if you know
how (Practical Common Lisp has a good secion on error handling).

For an overview of the SLIME debugger you can watch the video at,
http://common-lisp.net/project/movies/movies/slime.mov

I found that is better to downlowad the video and watch it with an
external video player.



On May 24, 11:42 am, Matt Emmonasd <themattemm...@gmail.com> wrote:
> This is seemingly identical to the source code from landoflisp.com for the
> wizards_game.lisp
>
> However, I continually get these errors when trying to input commands:
>
> [1]> (load "~/lisp/game.lisp")
>
> > ;; Loading file /Users/matt/lisp/game.lisp ...
> > ;; Loaded file /Users/matt/lisp/game.lisp
> > T
> > [2]> (game-repl)
> > look
> > *** - MAPCAR: A proper list must not end with LOOK
> > The following restarts are available:
> > ABORT          :R1      Abort main loop
>
> I figure there is something wrong with my *game-read *function. Cannot

Matt Emmonasd

unread,
Jun 3, 2012, 3:16:49 PM6/3/12
to land-o...@googlegroups.com
Hey Mauricio,

Thanks for the reply. I've watched the SLIME intro movie. Way way way beyond my level of understanding at the moment.


Seems to be fairly complicated to get emacs+lisp+slime+swank working together.

I've also dabble in Emacs a bit (vim also, which I prefer) and I feel like the learning curve is so steep and long.

I'm better off focusing on learning about Lisp before I tackle these development tools in earnest. 
(despite my debugging woes)



Thanks for the help, regardless!

Matt

reverland

unread,
Jun 3, 2012, 8:59:15 PM6/3/12
to land-o...@googlegroups.com
I use slimv in vim.It use slime as well.If you like vim,you can try it.

在 2012年5月25日星期五UTC+8上午1时42分17秒,Matt Emmonasd写道:
Reply all
Reply to author
Forward
0 new messages