• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

quick LISP question

RichieZ

Diamond Member
How do you specify default values for a keywords?

for example:

(defun test (&key x y)
(list x y))

how do i make the default value for x 1 and y 2

an example given in the book i'm using looks something like this:

(defun test (&key x y) '(🙂x 1)🙂y 2))
(list x y))

but this doesn't do anything, x and y are still both nil

I'm using Allegro CL
 
I assume you're talking about a LISP routine for AutoCAD? You can look in AutoCAD's support directory and look at the file acad.mns (I think - its been a while), and that should be a good example there...
 
Originally posted by: RichieZ
never mind i got it, its just like optional arguments.

I HATE ANSI COMMON LISP BY PAUL GRAHAM!

LOL, I didn't have a book when I was editing AutoLISP routines for my old company. I had to use the online help resource that came with Land Development Desktop 2000i 😀

 
Back
Top