Some tricky AutoLISP examples / more Lisp


AutoLISP

new AutoLISP is the scripting language for AutoCAD by Autodesk, a very crippled dynamic Lisp-1, based on very early xlisp sources (v1.0), posted by David Betz on usenet (alt.sources), and without proper copyright laws that time used by Autodesk as their free scripting language. There's an old Byte article about that.

To keep the language simple, some typical features such as macros, vectors, structs, destructive operations and objects were left out. Memory was low then in the late 80'ies. Since then the language itself was not improved at all, to keep things simple and to keep backwards portability. From time to time some library functions were added, such as DCL support (a cross-platform Dialog Control Language). More language features or library functions never made it besides some utility functions introduced with Vital Lisp (now Visual Lisp).

The language has several milestones since 1987:


Some trickies and goodies:

Sorting in AutoLISP

Definition
(sort data method) ;method: less-than-predicate ;default for numbers: '<
You want to know the fastest sort method?

First of all it depends on your data. Strings should always be sorted with the builtin (acad_strlsort) function. Numbers or points can be converted to strings:
http://ourworld.compuserve.com/homepages/tonyt/sortsort.htm
but dont use that with negative numbers or sort it using qsort() of the c lib (->ADS)
http://xarch.tu-graz.ac.at/autocad/news/sort.c
With Vital Lisp use the builtin (vlx-sort)
merge-sort is usually fastest but uses the most resources (see the FAQ: [16] stack overflow).
Some tricky sort functions use the internal hash-table for fast symbol access, but have some overhead (i.e. nssort) see http://www.autodesk.com/support/techdocs/td30/td300517.htm

Common Lisp ports

Trivia

new

Computional Geometry

misc

LISP

Common Lisp, Scheme, xlisp and other lisp supporting stuff which could be useful for AutoLISP programmers.

Recommended CL Reading

With new marked entries are from this year.


Other AutoCAD pages:


Reini Urban <rurban@xarch.tu-graz.ac.at> Created: 20.Jan 96 Last update: "2002-04-09 14:06:24 rurban"