Author Topic: Visual Lisp Console  (Read 1413 times)

0 Members and 1 Guest are viewing this topic.

Guido Rooms

  • Guest
Visual Lisp Console
« on: September 22, 2016, 05:50:23 AM »
Hello to all,

When I enter the following at the prompt without quoting : (1 . 2)
then nothing at all happens, at least nothing that I can see.
The prompt just reappears as if nothing at all was read.
Doing this should throw an exception,  I think...

Can anybody explain this to me?
I don't understand.
Thanks in advance.


Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Visual Lisp Console
« Reply #1 on: September 22, 2016, 08:05:34 AM »
Is anything printed at the AutoCAD command-line?

In my experience, VLIDE console errors are sometimes printed at the console and sometimes at the AutoCAD command-line.

Guido Rooms

  • Guest
Re: Visual Lisp Console
« Reply #2 on: September 22, 2016, 09:04:13 AM »
Lee,

That's it, the error message seems to go to the wrong place.
At the prompt it says "bad syntax of function call: (1 . 2)".

Thanks a lot.
Do you know of any other jokes like that?

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Visual Lisp Console
« Reply #3 on: September 22, 2016, 01:59:45 PM »
Code: [Select]
_$ (list (1 . 2))
; bad syntax of function call: (1 . 2)  ; <- this is printed in autocad's command prompt

_$ '((1 . 2))
((1 . 2))

_$ (list (cons 1 2))
((1 . 2))

_$ (1 . 2)
; bad syntax of function call: (1 . 2) ; <-  this is printed in autocad's command prompt

_$ (cons 1 2)
(1 . 2)
Conclusion: you must use apostrophe/quote for the list, for the "handmade" dotted pairs, otherwise AutoCAD reads them as a function calls.
I'm not a pro-lisper so my conclusion might be wrong or not full.
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg