Talk:AutoLISP
Appearance
This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
Shouldn't the link to the FAQ or to the newsgroup added? The AcadWiki maybe. --User:ReiniUrban
AutoLISP in other products
[edit]Do we need to list IntelliCAD based products as having AutoLISP functionality when IntelliCAD is already listed? There are two products already listed and there are many more that could fall into this. HughMillard 13:51, 24 July 2007 (UTC)
Errors in sample code?
[edit]There is some sample code in the Features section of the article.
- The comments above the defun forms suggest that the things being defined are macros. In Common Lisp, these would be called functions. Does AutoLISP terminology differ on this point?
- One of the comments ends with "without command-line interface exposed" and the other with "with command-line interface hidden". Don't these mean the same thing? IIRC, the "c:" prefix turns a symbol into a command that can be run from the AutoCAD command prompt without Lisp parentheses. So I would expect the defun c:hello_world to expose a command-line interface and the defun hello_world to hide one.
- Does (= (type a) 'INT) really work? In Common Lisp, the = function is only for numbers; to compare symbols, one uses EQ instead. The AutoLISP FAQ also mentions an EQ function.
- Does (mapcar '(lambda (x) (princ (b x))) a) really work? IIRC, in AutoLISP of AutoCAD 10, the form (lambda (x) (princ (b x))) returns the list ((x) (princ (b x))), which can then be called as a function. If you quote the whole thing, then the lambda symbol is left in the list; is the result still callable?
I hope someone with recent AutoLISP experience can clarify these points. 85.23.32.88 (talk) 19:51, 21 June 2008 (UTC)
Comments
[edit]- I agree that the comments should not use macro
- I also think that "without command-line interface exposed" and "with command-line interface hidden" should be changed.
- (= (type a) 'INT) works fine in AutoCAD
- This example I think would be better
(setq a '(1 2 3))
(defun b (x)
(+ x 5)
)
(cond
((= a b) (princ "\n(a) and (b) are equal"))
((and (= (type a) 'INT) (= (type b) 'INT))
(princ (strcat "\n(a)+(b)=" (itoa (+ a b)))))
((and (= (type a) 'STR) (= (type b) 'STR))
(princ (strcat "\n(a)+(b)=" a b)))
((and (listp a) (= (type b) 'USUBR))
(mapcar '(lambda (x) (princ (b x))) a)))
with this result 678 (6 7 8)
- "The language was appropriated (stolen)[citation needed] by Autodesk for use in AutoCAD Version 2.18 in January 1986" it is now. See this blog interview with John Walker. "And here was this thing called XLISP that was written by a fellow named David Betz who was, at the time, an employee of Digital Equipment Corporation in Massachusetts. And it was this tiny little PC LISP interpreter. Pure interpreter. And because he was an employee of Digital Equipment, their policy at the time was that, if you did any work on your own, you could either give it to them or you could put it in the public domain. He put it in the public domain. So that meant we were free to use it without any royalties or encumbrance."