<?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: vl-remove-if stupidity in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563194#M128543</link>
    <description>&lt;P&gt;You could look at the thread:&lt;/P&gt;&lt;P&gt;Remove duplicate points from a lis.&lt;/P&gt;&lt;P&gt;I would use use&amp;nbsp; LeeMac's&amp;nbsp; LM:UniqueFuzz&lt;/P&gt;&lt;P&gt;or&amp;nbsp; joselggalan's &amp;nbsp; RemoveEqualPts&lt;/P&gt;&lt;P&gt;functions, for speed.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Sep 2016 02:50:44 GMT</pubDate>
    <dc:creator>stevor</dc:creator>
    <dc:date>2016-09-15T02:50:44Z</dc:date>
    <item>
      <title>vl-remove-if stupidity</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563090#M128541</link>
      <description>&lt;P&gt;I know this might be rare, but I'm really feeling stupid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: (setq lst '(0.0 0.1 2.0 2.1 2.7 2.8 3.0 4.0))&lt;BR /&gt;(0.0 0.1 2.0 2.1 2.7 2.8 3.0 4.0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: (vl-remove-if '(lambda (a b)(equal a b 0.1)) lst)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;error: too few arguments&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whuh! &amp;nbsp;I have more arguments at home than I need!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2016 00:47:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563090#M128541</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2016-09-15T00:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: vl-remove-if stupidity</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563127#M128542</link>
      <description>&lt;P&gt;Your lambda needs a and b. So you may need to pass lst and (cdr lst)&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2016 01:22:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563127#M128542</guid>
      <dc:creator>Ranjit_Singh</dc:creator>
      <dc:date>2016-09-15T01:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: vl-remove-if stupidity</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563194#M128543</link>
      <description>&lt;P&gt;You could look at the thread:&lt;/P&gt;&lt;P&gt;Remove duplicate points from a lis.&lt;/P&gt;&lt;P&gt;I would use use&amp;nbsp; LeeMac's&amp;nbsp; LM:UniqueFuzz&lt;/P&gt;&lt;P&gt;or&amp;nbsp; joselggalan's &amp;nbsp; RemoveEqualPts&lt;/P&gt;&lt;P&gt;functions, for speed.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2016 02:50:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563194#M128543</guid>
      <dc:creator>stevor</dc:creator>
      <dc:date>2016-09-15T02:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: vl-remove-if stupidity</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563225#M128544</link>
      <description>&lt;P&gt;What kind of return are you expecting?&amp;nbsp; If you want to remove something if it's within 0.1 of an adjacent item&amp;nbsp;in the list [or perhaps within 0.1 of&amp;nbsp;&lt;EM&gt;any&lt;/EM&gt; item, if the list might not always be in numerical order?], which of the two do you want to remove?&amp;nbsp; The lower number?&amp;nbsp; The higher number?&amp;nbsp; Both?&amp;nbsp; The first one that occurs in the list, regardless of which is lower or higher, or the second one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to remove the &lt;EM&gt;first&lt;/EM&gt; number in any &lt;EM&gt;adjacent pair&lt;/EM&gt; that are within 0.1 of each other, this comparison of &lt;FONT color="#ff0000"&gt;each number&lt;/FONT&gt; to &lt;FONT color="#0000ff"&gt;the one immediately following it&lt;/FONT&gt; inexplicably removes &lt;EM&gt;one&lt;/EM&gt; of them [the 2.7]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(vl-remove-if '(lambda (&lt;FONT color="#ff0000"&gt;x&lt;/FONT&gt;) (equal &lt;FONT color="#ff0000"&gt;x&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;(cadr (member &lt;FONT color="#ff0000"&gt;x&lt;/FONT&gt; lst))&lt;/FONT&gt; 0.1)) lst)&lt;/P&gt;
&lt;P&gt;returns:&lt;BR /&gt;(0.0 0.1 2.0 2.1 2.8 3.0 4.0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;whereas [equally inexplicably, if the above doesn't work as expected]&amp;nbsp;if you stretch the fuzz factor just a little &lt;EM&gt;over&lt;/EM&gt; 0.1, it successfully removes &lt;EM&gt;all&lt;/EM&gt; of them:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(vl-remove-if '(lambda (&lt;FONT color="#ff0000"&gt;x&lt;/FONT&gt;) (equal &lt;FONT color="#ff0000"&gt;x&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;(cadr (member &lt;FONT color="#ff0000"&gt;x&lt;/FONT&gt; lst))&lt;/FONT&gt; 0.1&lt;STRONG&gt;01&lt;/STRONG&gt;)) lst)&lt;/P&gt;
&lt;P&gt;returns:&lt;BR /&gt;(0.1 2.1 2.8 3.0 4.0)&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2016 03:33:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6563225#M128544</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2016-09-15T03:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: vl-remove-if stupidity</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6564178#M128545</link>
      <description>That kinda makes sense. Thank you very much.&lt;BR /&gt;But why get the error "Too few arguments"?</description>
      <pubDate>Thu, 15 Sep 2016 13:45:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6564178#M128545</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2016-09-15T13:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: vl-remove-if stupidity</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6564606#M128546</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3930636"&gt;@john.uhden&lt;/a&gt; wrote:&lt;BR /&gt;....&amp;nbsp;why get the error "Too few arguments"?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Because [I think] as&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3261555"&gt;@Ranjit_Singh&lt;/a&gt;&amp;nbsp;pointed out in Post 2, the (lambda) function lists &lt;EM&gt;two&lt;/EM&gt; arguments, but it's only going to get &lt;EM&gt;one&lt;/EM&gt; supplied by each step of its stepping through the list one item at a time. &amp;nbsp;Help for (vl-remove-if) says the predicate function [in this case the (lambda) function] "...can be any function that accepts a &lt;STRONG&gt;&lt;EM&gt;single&lt;/EM&gt;&lt;/STRONG&gt; argument and returns T for any user-specified condition." &amp;nbsp;That's why I tried a version with only &lt;EM&gt;one&lt;/EM&gt; argument [x] and pulling what it has to compare to from the list at&amp;nbsp;a position defined &lt;EM&gt;relative to&lt;/EM&gt; that one. &amp;nbsp;I was very doubtful about being able to include the list variable &lt;EM&gt;within&lt;/EM&gt; the (lambda) operation as well as at the end for (vl-remove-if) to apply that (lambda) function&amp;nbsp;to&amp;nbsp;--&amp;nbsp;possibly [who knows?] that's part of the reason it doesn't work as expected with the 0.1 fuzz factor. &amp;nbsp;But I'm completely at a loss to explain why it &lt;EM&gt;does&lt;/EM&gt; with that increased a little [nor do I recall what gave&amp;nbsp;me the idea to try that].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: &amp;nbsp;That single-argument limitation in the description for the predicate function in (vl-remove-if) is made puzzling by the fact that it then lists, among the forms that function can take:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'(LAMBDA (A1 A2) ...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[as well as the embedded-in-(function) equivalent], which shows &lt;EM&gt;two&lt;/EM&gt; arguments, and looks a lot like your original code. &amp;nbsp;I would have to assume that aspect is a typographical error in the Help page.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2016 16:02:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-remove-if-stupidity/m-p/6564606#M128546</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2016-09-15T16:02:37Z</dc:date>
    </item>
  </channel>
</rss>

