This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Type error

8 posts · 1590 views

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

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

@Ramarren: Thanks for the reply.. I'm using Poderosa...could you tell me how can I use debugging facility there??

Re: Type error

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

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

@nuntius: Forgot to add..yeah it's the first google hit when one types Poderosa.

Re: Type error

@ 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

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]
;; 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).