Author Topic: Error when creating a very basic Lisp routine  (Read 3495 times)

0 Members and 1 Guest are viewing this topic.

brennon

  • Guest
Error when creating a very basic Lisp routine
« on: December 21, 2004, 03:41:40 PM »
Hello  :D

I am learning lisp and this may sound like a dumb question.  Sorry in advance!!

I am trying to create a very basic lisp routine.  When I try to load the lisp through the Visual LISP editor, I get the following error:

_$

Error: malformed list on input    :x
_$

When I try to load it by typing (load "plmt") at the command line I get an error aswell.

I know that I am missing something or somethings.  What is it that I missed?

The basic lisp routine is below.


(defun c: plmt ()
;Measure the Distance between 2 points

(setq a (getpoint "\nEnter First Point : "))
;get the first point

(setq b (getpoint "\nEnter Second Point : "))
;get second point

(command "dist" a b "")
;measure the distance

;end defun

Thanks for the help in advance!!

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Error when creating a very basic Lisp routine
« Reply #1 on: December 21, 2004, 03:48:42 PM »
No space after the C: in the defun statement...no "" after the a b in the distance command (the "" causes a repeat of the command)...and missing the closing ) for the defun...

EDIT: added a (princ) to exit quietly...
Code: [Select]
(defun c:plmt ()
;Measure the Distance between 2 points

(setq a (getpoint "\nEnter First Point : "))
;get the first point

(setq b (getpoint "\nEnter Second Point : "))
;get second point

(command "dist" a b)
;measure the distance
(princ)
);end defun

brennon

  • Guest
Error when creating a very basic Lisp routine
« Reply #2 on: December 22, 2004, 12:39:52 PM »
Thanks Dommy2Hotty

It worked great

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Error when creating a very basic Lisp routine
« Reply #3 on: December 22, 2004, 12:42:00 PM »
Quote from: brennon
Thanks Dommy2Hotty

It worked great


Glad I could help...makes me feel like I know something... :lol: