<?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 Copy of a function in JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Copy-of-a-function-in-JSL/m-p/426827#M67659</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;my function F is a complex function and in some cases I need to redefine it while keeping its old functionality. I would like to keep a copy of F before changing it. So far, I did not find a way to do this in JSL. Here is a small example, what I am trying to do. What is the correct way to really copy a function and not just link it?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;F = Function( {x,y}, x+y ); // actually much more complex
Show(F(1,2)); // 3
// G = F; // Error, JMP complains about missing parameters
G = Function( {x,y}, F(x,y));
Show(G(1,2)); // 3
F = Function( {x,y}, x*y ); // Changes G, too.
Show(F(1,2)); // 2
Show(G(1,2)); // 2, but I want it to remain 3.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 18:02:44 GMT</pubDate>
    <dc:creator>Robbb</dc:creator>
    <dc:date>2023-06-09T18:02:44Z</dc:date>
    <item>
      <title>Copy of a function in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Copy-of-a-function-in-JSL/m-p/426827#M67659</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;my function F is a complex function and in some cases I need to redefine it while keeping its old functionality. I would like to keep a copy of F before changing it. So far, I did not find a way to do this in JSL. Here is a small example, what I am trying to do. What is the correct way to really copy a function and not just link it?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;F = Function( {x,y}, x+y ); // actually much more complex
Show(F(1,2)); // 3
// G = F; // Error, JMP complains about missing parameters
G = Function( {x,y}, F(x,y));
Show(G(1,2)); // 3
F = Function( {x,y}, x*y ); // Changes G, too.
Show(F(1,2)); // 2
Show(G(1,2)); // 2, but I want it to remain 3.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:02:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Copy-of-a-function-in-JSL/m-p/426827#M67659</guid>
      <dc:creator>Robbb</dc:creator>
      <dc:date>2023-06-09T18:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Copy of a function in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Copy-of-a-function-in-JSL/m-p/426922#M67660</link>
      <description>&lt;P&gt;You can essentially grab the function pointer with the &lt;CODE class=""&gt;Name Expr()&lt;/CODE&gt; command&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;F = Function( {x,y}, x+y ); // actually much more complex
Show(F(1,2)); // 3
G = Name Expr( F ); // use the magic NameExpr function to grab a pointer
Show(G(1,2)); // 3
F = Function( {x,y}, x*y ); // Changes G, too.
Show(F(1,2)); // 2
Show(G(1,2)); // 2, but I want it to remain 3.

/*:
F(1, 2) = 3;
G(1, 2) = 3;
F(1, 2) = 2;
G(1, 2) = 3;
*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like there is an issue on this site preventing proper JSL code insertion&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 11:15:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Copy-of-a-function-in-JSL/m-p/426922#M67660</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2021-10-15T11:15:36Z</dc:date>
    </item>
  </channel>
</rss>

