Type error

Discussion of Common Lisp
Post Reply
FedEx
Posts: 5
Joined: Sat Oct 02, 2010 11:31 pm

Type error

Post by FedEx » Sat Oct 02, 2010 11:39 pm

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!

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: Type error

Post by ramarren » Sun Oct 03, 2010 12:24 am

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.

FedEx
Posts: 5
Joined: Sat Oct 02, 2010 11:31 pm

Re: Type error

Post by FedEx » Sun Oct 03, 2010 8:58 am

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

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Type error

Post by nuntius » Sun Oct 03, 2010 9:30 am

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.

FedEx
Posts: 5
Joined: Sat Oct 02, 2010 11:31 pm

Re: Type error

Post by FedEx » Sun Oct 03, 2010 10:00 am

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?

FedEx
Posts: 5
Joined: Sat Oct 02, 2010 11:31 pm

Re: Type error

Post by FedEx » Sun Oct 03, 2010 10:03 am

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

FedEx
Posts: 5
Joined: Sat Oct 02, 2010 11:31 pm

Re: Type error

Post by FedEx » Sun Oct 03, 2010 7:47 pm

@ 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.

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Type error

Post by nuntius » Sun Oct 03, 2010 9:10 pm

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

Post Reply