manase 发表于 2022-7-6 06:25:54

What's wrong here?

Any help?

(defun c:rn (/) (setq    l (list    (list 1 2 nil)       (list 477 nil 899 0)       (list nil 45577 "gh" (list 4 5) nil 0 56)       (list 5 6 7 nil 45 nil "test")   ) ) (setq li nil) (setq i 0) (repeat (length l)   (setq e (nth i l))   (vl-remove-if   '(lambda (x) (or (= 0 x) (= nil x)))   e   ) ;_ end of vl-remove-if   (setq i (1+ i))   (setq li (cons e li)) ))

pBe 发表于 2022-7-6 06:44:31

 
Any more information?

manase 发表于 2022-7-6 06:49:42

(defun rn3 (l / li e x) (reverse   (foreach e l   (setq   li (cons      (vl-remove-if          '(lambda (x) (or (= 0 x) (= nil x) (= (type x) 'str)))          e      )      li      )   )   ) ))
 
This is what i get, and what i wanted ... sorry for no more information - a function to remove nil, o or strings from a list that contains lists.

pBe 发表于 2022-7-6 07:03:37

Information meaning what will the desired result look like?
 
So you already have a solution with rn3?

manase 发表于 2022-7-6 07:08:42

Yes, but more solutions are better... variant?

pBe 发表于 2022-7-6 07:22:32

 
another way to look at it isremove all non-numeric item on the list?

manase 发表于 2022-7-6 07:33:35

Yes, can work that way too.
页: [1]
查看完整版本: What's wrong here?