From: Chian-Shan, Suen
Subject: how to use autolisp under autocad
Date: 
Message-ID: <01bc4e2f$ea707800$7ca9708c@hntp1.ntu.edu.tw>
Sorry to ask a question, I just installed the autocad, but I found that the
program I have done under common lisp can't run under autolisp, is this
true?

Another one is that how to run it with the function which I defined and how
to give the argument? For example: when I define a function somthing like 
(GGCD a b) which will return the GCD of  the argument a and b, when I run
it with (GGCD 5 10), it show the message ==> *cancel*   why?
follow is my program:
(DEFUN GGCD(a b)
   (IF (ZEROP (MOD a b)) b
              (GGCD b (MOD a b)))  
  )

May somebody can give me any suggestion about how to handle it under
autolisp, thanks a lot.

-- 
Chian-Shun, Suen
My e-mail adrress: ········@cc.ntu.edu.tw

From: nirsul
Subject: Re: how to use autolisp under autocad
Date: 
Message-ID: <E981AJ.n1C@nonexistent.com>
On 21 Apr 1997 08:33:51 GMT, "Chian-Shan, Suen"
<········@cc.ntu.edu.tw> wrote:

>
>Sorry to ask a question, I just installed the autocad, but I found that the
>program I have done under common lisp can't run under autolisp, is this
>true?
>
>Another one is that how to run it with the function which I defined and how
>to give the argument? For example: when I define a function somthing like 
>(GGCD a b) which will return the GCD of  the argument a and b, when I run
>it with (GGCD 5 10), it show the message ==> *cancel*   why?
>follow is my program:
>(DEFUN GGCD(a b)
>   (IF (ZEROP (MOD a b)) b
>              (GGCD b (MOD a b)))  
>  )
>
>May somebody can give me any suggestion about how to handle it under
>autolisp, thanks a lot.
>
>-- 
>Chian-Shun, Suen
>My e-mail adrress: ········@cc.ntu.edu.tw


This is because AutoCAD 's AutoLISP does not have the MOD function
From: Christoph Candido
Subject: Re: how to use autolisp under autocad
Date: 
Message-ID: <33636380.7635262@news.boku.ac.at>
"Chian-Shan, Suen" <········@cc.ntu.edu.tw> wrote:
>Sorry to ask a question, I just installed the autocad, but I found that the
>program I have done under common lisp can't run under autolisp, is this
>true?
>
>Another one is that how to run it with the function which I defined and how
>to give the argument? For example: when I define a function somthing like 
>(GGCD a b) which will return the GCD of  the argument a and b, when I run
>it with (GGCD 5 10), it show the message ==> *cancel*   why?
>follow is my program:
>(DEFUN GGCD(a b)
>   (IF (ZEROP (MOD a b)) b
>              (GGCD b (MOD a b)))  
>  )
>
>May somebody can give me any suggestion about how to handle it under
>autolisp, thanks a lot.

First of all, it's better to ask such questions in comp.cad.autocad
and not in comp.lang.lisp.

Wherever, your function can't work, because the AutoLISP modulo
function is called REM and not MOD:

(defun ggcd (a b)
  (if (zerop (rem a b))
    b
    (ggcd b (rem a b))
  )
)

AutoLISP is based on XLISP from David Betz. Look at comp.lang.lisp.x.

If you need info about AutoLISP, read the AutoLISP-FAQ from Reini
Urban in comp.cad.autocad or
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html,
it's really worth reading.

Hope this info helps,
Chris
--
*********************************************
Christoph Candido
E-Mail: ········@edv1.boku.ac.at
University of Agricultural Sciences
Vienna, Austria
*********************************************