Author Topic: Nil  (Read 5543 times)

0 Members and 1 Guest are viewing this topic.

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Nil
« Reply #15 on: October 29, 2011, 06:56:31 AM »
I always thought they bound nil to an empty list is so that it would not error out on certain calls

You would think that this would produce an error:

Code: [Select]
(setq ed nil)
(cdr (assoc 10 ed))

But it doesn't because (assoc) is searching a list.  There are several other examples of this behavior.  -David
R12 Dos - A2K

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Nil
« Reply #16 on: October 29, 2011, 07:12:02 AM »
Quote
I always thought they bound nil to an empty list is so that it would not error out on certain calls

As LISP in a dynamic typed language, nil type checking is performed at run-time and I think it is bound according to the context.
Speaking English as a French Frog

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Nil
« Reply #17 on: October 29, 2011, 08:17:24 AM »
Some good explanations and examples gile.  :-)

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Nil
« Reply #18 on: October 29, 2011, 12:58:41 PM »
Thanks gile!!

AWW

  • Guest
Re: Nil
« Reply #19 on: December 08, 2011, 10:55:33 AM »
I wanted to re-visit this NIL thread again while analyzing this code here:

Code: [Select]
(DleaderWhile
;DleaderWhile subfunction call
   nil
;empty list
   (vlax-ename->vla-object (car DQobject))
;(retrieve first element of DQobject *list*) (transform DQobject entity to vla-object)
   nil
;empty list
)

Notice I've added some comments for what I think is going on. So is this just setting the list empty? To be filled later within the program? Or to preserve memory?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Nil
« Reply #20 on: December 08, 2011, 11:25:37 AM »
Perhaps those arguments are boolean flags requiring a T/nil value, it would depend how those arguments are used in the function.