<?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: lambda in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820370#M68707</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;LI-CODE lang="lisp"&gt;(setq lst '((10 10 110) (10 34 3) (56 89 245)))
(mapcar	'(lambda (l)
	   (mapcar '- l (Car lst))
	 )
	lst
)&lt;/LI-CODE&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above algorithm translated to the common functions for better understanding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun :mapcar-alternative (lst-o  / 1st-o idx itm-o itm-n lst-n)
  
  (setq lst-n '()
	1st-o (car lst-o))
  
  (foreach itm-o lst-o
    (setq idx 0
	  itm-n '())
    
    (repeat (min (length itm-o)
		 (length 1st-o))
      (setq itm-n (append itm-n (list (- (nth idx itm-o)
					 (nth idx 1st-o))))
	    idx (1+ idx)))
    
    (setq lst-n (append lst-n (list itm-n))))
  
  lst-n)
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;btw nice one pBe!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Oct 2020 12:20:00 GMT</pubDate>
    <dc:creator>ВeekeeCZ</dc:creator>
    <dc:date>2020-10-23T12:20:00Z</dc:date>
    <item>
      <title>lambda</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820055#M68703</link>
      <description>&lt;P&gt;After years of lisping I still haven't got round to using lambda. I have a situation now where I think one would be appropriate. I would normally sort this out with while or foreach or repeat but I'd like to attack this with lambda. I have a list of XYZ points and I would like to create a new list of the difference between the XY and Z of each point with reference to the first point. So:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'((10 10 110) (10 34 3) (56 89 245))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;would result in&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'((0 0 0) (0 24 -107) (46 79 135))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone very kindly point me in the right direction?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 09:16:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820055#M68703</guid>
      <dc:creator>scott_bolton</dc:creator>
      <dc:date>2020-10-23T09:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: lambda</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820078#M68704</link>
      <description>&lt;LI-CODE lang="lisp"&gt;(setq lst '((10 10 110) (10 34 3) (56 89 245)))
(mapcar	'(lambda (l)
	   (mapcar '- l (Car lst))
	 )
	lst
)&lt;/LI-CODE&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 09:27:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820078#M68704</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2020-10-23T09:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: lambda</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820096#M68705</link>
      <description>&lt;P&gt;Jeez, that easy eh? &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Thanks, pbejse. Something for me to work on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 09:33:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820096#M68705</guid>
      <dc:creator>scott_bolton</dc:creator>
      <dc:date>2020-10-23T09:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: lambda</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820141#M68706</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3704761"&gt;@scott_bolton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Jeez, that easy eh? &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Thanks, pbejse. Something for me to work on.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;You are welcome S,&amp;nbsp; I'm sure there's another way to code it using lambda, that's the first thing that pops into my head though .&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Cheers&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 10:07:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820141#M68706</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2020-10-23T10:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: lambda</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820370#M68707</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;LI-CODE lang="lisp"&gt;(setq lst '((10 10 110) (10 34 3) (56 89 245)))
(mapcar	'(lambda (l)
	   (mapcar '- l (Car lst))
	 )
	lst
)&lt;/LI-CODE&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above algorithm translated to the common functions for better understanding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun :mapcar-alternative (lst-o  / 1st-o idx itm-o itm-n lst-n)
  
  (setq lst-n '()
	1st-o (car lst-o))
  
  (foreach itm-o lst-o
    (setq idx 0
	  itm-n '())
    
    (repeat (min (length itm-o)
		 (length 1st-o))
      (setq itm-n (append itm-n (list (- (nth idx itm-o)
					 (nth idx 1st-o))))
	    idx (1+ idx)))
    
    (setq lst-n (append lst-n (list itm-n))))
  
  lst-n)
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;btw nice one pBe!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 12:20:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820370#M68707</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-10-23T12:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: lambda</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820530#M68708</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3704761"&gt;@scott_bolton&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This might help you for future reference. It's just a visualization so you can see kind-of what's happening...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun Add1 (num / ) (+ num 1))
(setq Add2 (lambda (num) (+ num 2)))

(Add1 2) -&amp;gt; returns 3
(Add2 1) -&amp;gt; returns 3&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 13:24:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lambda/m-p/9820530#M68708</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2020-10-23T13:24:11Z</dc:date>
    </item>
  </channel>
</rss>

