Are you sleeping, Mr. M. Puckett?

Discussion in 'AutoCAD' started by Fatty, Nov 7, 2004.

  1. Fatty

    Fatty Guest

    It's a bug?

    Example:
    (member 'nil '(nil nil nil nil nil))
    Result : (nil nil nil nil nil)
    (member (nth 2 '(nil nil nil nil nil))'(nil nil nil nil nil)))
    Result : (nil nil nil nil nil)

    My solution:
    (defun nts (n lst )
    (cond ((zerop n) lst)
    (T (append (cdr lst))(nts (1- n)(cdr lst)))))

    (nth 2 '(nil nil nil nil nil))
    Result : nil
    (nts 2 '(nil nil nil nil nil))
    Result : (nil nil nil);it's right ?

    Please, listing only, bcs i d't unstd engsh
     
    Fatty, Nov 7, 2004
    #1
  2. Fatty

    Jeff Mishler Guest

    No, it's not a bug. Member returns the list beginning with the first
    instance found.
    Yours works IF you want to know if the 3rd element in one list is also in
    the other list beginning with the 3rd element.

    Sorry, don't know another way to explain it.
     
    Jeff Mishler, Nov 7, 2004
    #2
  3. Fatty

    Fatty Guest

    Thanx, Jeff
    But ...
     
    Fatty, Nov 7, 2004
    #3
  4. Fatty

    Tom Smith Guest

    (member (nth 2 '(nil nil nil nil nil))'(nil nil nil nil nil)))
    Not a bug.

    (nth 2 '(nil nil nil nil nil))
    Result: nil
    (member 'nil '(nil nil nil nil nil))
    Result : (nil nil nil nil nil)
     
    Tom Smith, Nov 8, 2004
    #4
  5. Fatty

    Fatty Guest

    Excuse me, Tom.
    It's my damn' autumnal brain bug ...
    Result : (cons 'Lisparanoia (list '(too many aplomb)))
    Thanx,
    ~'O'~
     
    Fatty, Nov 8, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.