<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Removing elements from a nested list in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10515141#M57541</link>
    <description>&lt;P&gt;Based on your example lists are you wanting to remove duplicate entries ?&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(setq l '((1 2 3 4) (1 2 3 4) (1 2 3 4)))
(cons (car l) (vl-remove (car l) l))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="http://www.lee-mac.com/uniqueduplicate.html" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;This&lt;/STRONG&gt;&lt;/A&gt; too.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Aug 2021 20:57:32 GMT</pubDate>
    <dc:creator>ronjonp</dc:creator>
    <dc:date>2021-08-02T20:57:32Z</dc:date>
    <item>
      <title>Removing elements from a nested list</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10510631#M57538</link>
      <description>&lt;P&gt;Hi.&lt;BR /&gt;What way is there to remove certain elements from lists included in a nested list?&lt;BR /&gt;If the original list is like this:&lt;BR /&gt;&lt;STRONG&gt;'((1 2 3 4) (1 2 3 4) (1 2 3 4))&lt;/STRONG&gt;&lt;BR /&gt;how to remove elements (nth 1) and (nth 2) from the list to transform it:&lt;BR /&gt;&lt;STRONG&gt;'((1 4) (1 4) (1 4))&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 14:09:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10510631#M57538</guid>
      <dc:creator>Browning_Zed</dc:creator>
      <dc:date>2021-07-31T14:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Removing elements from a nested list</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10510675#M57539</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun rem_nth (lst ntlst / a i ret)
	(foreach e lst
	   (setq i -1)
	   (while (&amp;lt; (setq i (1+ i)) (length e))
			(if (not(member i ntlst)) (setq a (cons (nth i e) a)))
	   )
	   (setq ret (cons (reverse a) ret) a nil)
	)
	(reverse ret)
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Example
(setq mm '((1 2 3 4) (5 6 7 8 )  (9 10 11 12)))
(rem_nth mm '(0 1))
;--&amp;gt;((3 4) (7 8 ) (11 12))&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Example 2:
Command: (setq mm '((1 2 3 4) (5 6) (9 10 12)))
((1 2 3 4) (5 6) (9 10 12))
Command: (rem_nth mm '(3 4))
((1 2 3) (5 6) (9 10 12))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 14:51:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10510675#M57539</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-07-31T14:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Removing elements from a nested list</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10514569#M57540</link>
      <description>&lt;P&gt;Another&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun _remover (l o)
  (if l
    (cons
      (repeat (setq i (length (car l)))
	      (if (not (vl-position (setq i (1- i)) o))
		(setq nl (cons (nth i (car l)) nl))
	      ) nl
	    )
      (_remover (cdr l) (progn (setq nl nil) o))
      )
    )
  )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(defun _remove (lst n / a i nl l)
  (while (setq a (car lst))
    (setq nl  nil lst (Cdr lst))
    (repeat (setq i (length a))
      (if (not (vl-position (setq i (1- i)) n))
	(setq nl (cons (nth i a) nl))
      )
    )
    (setq l (cons nl l))
  )
  (reverse l)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;HTH&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 16:28:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10514569#M57540</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2021-08-02T16:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Removing elements from a nested list</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10515141#M57541</link>
      <description>&lt;P&gt;Based on your example lists are you wanting to remove duplicate entries ?&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(setq l '((1 2 3 4) (1 2 3 4) (1 2 3 4)))
(cons (car l) (vl-remove (car l) l))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="http://www.lee-mac.com/uniqueduplicate.html" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;This&lt;/STRONG&gt;&lt;/A&gt; too.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 20:57:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-elements-from-a-nested-list/m-p/10515141#M57541</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2021-08-02T20:57:32Z</dc:date>
    </item>
  </channel>
</rss>

