;; | --------------------------------------------------------------------------- ;; | LI_memb ;; | --------------------------------------------------------------------------- ;; | Function : MEMB - member with equal's uncertainty check (diff: real number) ;; | Argument : 'ele' - Element to check, if in list ;; | 'Lst' - List to be checked ;; | 'diff' - A fuzzy tolerance to check for equality ;; | Returns : The list index (starting from 0) where the first occurance of ;; | 'ele' is found else nil ;; | Update : May 2, 2004 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun LI_memb(ele Lst diff / len cnt Found) (if (zerop Diff) (progn (setq Found (member ele Lst)) (if Found (setq Found T)) ) (progn (setq len (length Lst) cnt 0 Found nil ) (while (and (< cnt len) (not Found)) (if (equal ele (nth cnt Lst) diff) (setq Found T) (setq cnt (1+ cnt)) ) ) )) (if Found cnt nil) )