Page 1 of 1

Type error

Posted: Sat Oct 02, 2010 11:39 pm
by FedEx
While trying to run my program I'm coming across the following error:

Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
(1 2 3 4 5 6 7 8 0) is not of type NUMBER
[Condition of type TYPE-ERROR]

The program I'm trying involves implementation of DFS to 8puzzle. The list (1 2 3 4 5 6 7 8 0) is a sample input. Could you please provide any pointers as to what might be wrong with my code?

Thanks!

Re: Type error

Posted: Sun Oct 03, 2010 12:24 am
by ramarren
The error message is quite clear: you are passing a list to something the expects a number. It is impossible to say anything more without looking at your code. You can use debugging facilities of your Lisp implementation to locate the error more precisely, which is made simpler by using Slime debugger.

Re: Type error

Posted: Sun Oct 03, 2010 8:58 am
by FedEx
@Ramarren: Thanks for the reply.. I'm using Poderosa...could you tell me how can I use debugging facility there??

Re: Type error

Posted: Sun Oct 03, 2010 9:30 am
by nuntius
Is "Poderosa" a mswin terminal emulator? [first google hit]

Which CL implementation and editor are you using?

The two main commercial implementations [see http://common-lisp.net/~dlw/LispSurvey.html] have free personal editions with a built-in IDE. Most people using a free CL use the Slime plugin for Emacs. Some people use the CUSP plugin with Eclipse. On macos, there is MCLIDE. Or you can use a terminal directly (some implementations have readline support).

The exact way to use the debugger depends on your implementation and editing environment.

Re: Type error

Posted: Sun Oct 03, 2010 10:00 am
by FedEx
nuntius wrote:Is "Poderosa" a mswin terminal emulator? [first google hit]

Which CL implementation and editor are you using?

The two main commercial implementations [see http://common-lisp.net/~dlw/LispSurvey.html] have free personal editions with a built-in IDE. Most people using a free CL use the Slime plugin for Emacs. Some people use the CUSP plugin with Eclipse. On macos, there is MCLIDE. Or you can use a terminal directly (some implementations have readline support).

The exact way to use the debugger depends on your implementation and editing environment.
@nuntius: I'm using CMU Common Lisp..with emacs editor..in Unix environment
So should I install the Slime plug-in...and how?

Re: Type error

Posted: Sun Oct 03, 2010 10:03 am
by FedEx
@nuntius: Forgot to add..yeah it's the first google hit when one types Poderosa.

Re: Type error

Posted: Sun Oct 03, 2010 7:47 pm
by FedEx
@ all: Thanks for your inputs...I finally managed to get read of all the bugs (which were giving the error mentioned in my original post)..As Ramaren pointed out the error was due to wrong type of argument being passed to the functions.

But guys I still need help regarding getting a debugger facility such as Slime as couple of our friends mentioned. Looking forward to your inputs on that.

Re: Type error

Posted: Sun Oct 03, 2010 9:10 pm
by nuntius
To install slime, download the latest CVS snapshot from the SLIME project.

Here's an extract from my ~/.emacs file that shows how to get the system basically working. [not authoritative -- there may be better ways to do some of this]

Code: Select all

;; optional:  swap [] with ()
(keyboard-translate ?\( ?\[)
(keyboard-translate ?\[ ?\()
(keyboard-translate ?\) ?\])
(keyboard-translate ?\] ?\))

;; External LISP setup
;; run as "M-- M-x slime"
;; a simple "M-x slime" starts the first option
(setq slime-lisp-implementations
      '((sbcl ("/usr/local/bin/sbcl"))
        (ecl  ("/home/nuntius/usrlocal/bin/ecl"))
        (clozure ("/home/nuntius/usrlocal/bin/ccl"))
        (clim ("/usr/local/bin/sbcl" "--core" "/usr/local/lib/sbcl/mcclim.core"))
        (clisp ("/usr/bin/clisp"))))

;;(slime-setup)
(add-to-list 'load-path "/home/nuntius/lisp/slime") ; path to slime source tree
(require 'slime-autoloads)
(require 'slime)
(slime-setup '(slime-fancy slime-scratch slime-editing-commands)) ; there are many more to choose from

(add-hook 'lisp-mode-hook 
          (lambda () 
            (slime-mode t)
            (local-set-key "\r" 'newline-and-indent)
            (setq lisp-indent-function 'common-lisp-indent-function)
            (setq indent-tabs-mode nil)))
(define-key slime-mode-map 
  (kbd "TAB") 'slime-indent-and-complete-symbol)
;(slime)
In addition to slime, you may also want to try ParEdit. There are also ways to start the swank server on a remote lisp and connect to it using emacs/SLIME on your local computer (using ssh as needed for security).