TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: brennon on December 21, 2004, 03:41:40 PM

Title: Error when creating a very basic Lisp routine
Post by: brennon 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!!
Title: Error when creating a very basic Lisp routine
Post by: Dommy2Hotty 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
Title: Error when creating a very basic Lisp routine
Post by: brennon on December 22, 2004, 12:39:52 PM
Thanks Dommy2Hotty

It worked great
Title: Error when creating a very basic Lisp routine
Post by: Dommy2Hotty 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: