Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I again had a need to process the list. There was a need to filter the list if a certain item position exists.
In details:
in each nested list, all items can be numbered according to position like this:
;; items: 1 2 3 1 2 3 1 2 3 1 2 3
(setq lst '(("1" a nil) ("2" nil 20.0) (nil nil 30.0) (nil nil 40.0)))
now how to create a new list from the original list if an item with a certain number exists? For example, when executing a function in which the first argument is a list of item number positions, then:
(setq lst '(("1" a nil) ("2" nil 20.0) (nil nil 30.0) (nil nil 40.0)))
(somefunction '(1) lst)
;; =>> '(("1" a nil) ("2" nil 20.0))
(somefunction '(2) lst)
;; =>> '(("1" a nil))
(somefunction '(2 3) lst)
;; =>> '(("1" a nil) ("2" nil 20.0) (nil nil 30.0) (nil nil 40.0))
Solved! Go to Solution.