<?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: What's wrong here? Expression issue in Formula() in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802335#M97858</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Head(Expr(Function()))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;nice!&lt;BR /&gt;much better than my &lt;FONT face="courier new,courier"&gt;Eval( ... Parse(&lt;/FONT&gt;&amp;nbsp; ...&amp;nbsp; &amp;nbsp;especially after citing Joseph's&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1727423569763.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68656i8A626F25FEE18EBF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1727423569763.png" alt="hogi_1-1727423569763.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 28 Sep 2024 07:10:44 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2024-09-28T07:10:44Z</dc:date>
    <item>
      <title>What's wrong here? Expression issue in Formula()</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/801895#M97780</link>
      <description>&lt;P&gt;&lt;FONT face="arial black,avant garde" color="#FF0000"&gt;Caution - JMP will crash!!!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

f = Function( {}, 
/* ....  */ 
	ID = Associative Array( {{Name Expr(), 1}, {Expr(), 2}, {Function(), 3}}, 0 );&lt;BR /&gt;/* ....  */ 
);
f();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;removing the &lt;FONT face="courier new,courier"&gt;function()&lt;/FONT&gt; from the list fixes the error.&lt;BR /&gt;Taking the associative array out of the outer &lt;FONT face="courier new,courier"&gt;function&lt;/FONT&gt; fixes the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[edit] a motivation why this can be helpful:&lt;/P&gt;&lt;P&gt;as a lookup table for parts of expressions -&amp;nbsp;identified via &lt;FONT face="courier new,courier"&gt;Head()&lt;/FONT&gt;and &lt;FONT face="courier new,courier"&gt;Type():&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myID = ID[Expr(function())]; //  expected: 3

code = Expr(g = function ({x},1));
Head(Arg(code,2)); // function()
myID = ID[Head(Arg(code,2))]; // expected: 3&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Sep 2024 12:23:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/801895#M97780</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-27T12:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong here?</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/801905#M97781</link>
      <description>&lt;P&gt;It sure does blow JMP away.&amp;nbsp; You just invented a new fast way to exit from a JMP session......&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This needs to go to JMP Support!&amp;nbsp; &amp;nbsp;Things like this are not supposed to happen.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 00:50:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/801905#M97781</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-09-26T00:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong here?</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802086#M97805</link>
      <description>&lt;P&gt;I have another one:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;Caution - JMP will crash!!!&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = Expr(Function());

Show(name Expr(x) == Expr(Function()));
Print("not dead");

f = function({arg},
name Expr(arg) == Expr(Function()))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;outside of the function the comparison of x with &lt;FONT face="courier new,courier"&gt;Function ()&lt;/FONT&gt; is OK.&lt;/P&gt;&lt;P&gt;Inside of the function, JMP will already crash when it sees the command - no need to call &lt;FONT face="courier new,courier"&gt;f&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 11:15:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802086#M97805</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-30T11:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong here?</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802210#M97833</link>
      <description>&lt;P&gt;from JMP support (TS- 00166834):&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;There is a known issue where JMP crashes when using a malformed function in another function.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So, the root cause can be narrowed down to&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Caution - JMP will crash!!!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;f = Function( {}, 	Expr(Function()));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... looking so innocent.&lt;EM&gt;&lt;BR /&gt;&lt;BR /&gt;malformed&amp;nbsp;&lt;/EM&gt;&amp;nbsp;&lt;U&gt;function&lt;/U&gt; definition - yes.&amp;nbsp;But it's a "well formed" JSL expression&amp;nbsp; according to&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/78"&gt;@joseph_morgan&lt;/a&gt;&amp;nbsp;/&amp;nbsp;&amp;nbsp;&lt;LI-MESSAGE title="Using JSL to Develop Efficient, Robust Applications (EU 2018 415)" uid="51456" url="https://community.jmp.com/t5/Discovery-Summit-Europe-2018/Using-JSL-to-Develop-Efficient-Robust-Applications-EU-2018-415/m-p/51456#U51456" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, surprising that JMP cannot live with it.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Function&lt;/FONT&gt; inside &lt;FONT face="courier new,courier"&gt;Function&lt;/FONT&gt; reminds me of&amp;nbsp;&lt;LI-MESSAGE title="JMP Expr() weirdness, can anyone explain?" uid="400469" url="https://community.jmp.com/t5/Discussions/JMP-Expr-weirdness-can-anyone-explain/m-p/400469#U400469" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;/ &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26363"&gt;@ErraticAttack&lt;/a&gt;&amp;nbsp;.&lt;BR /&gt;So, besides the users, even JMP has issues when an expression shows up on different levels. So, maybe&amp;nbsp;&lt;LI-MESSAGE title="Insert Into: Flatten(0|1)" uid="748326" url="https://community.jmp.com/t5/JMP-Wish-List/Insert-Into-Flatten-0-1/m-p/748326#U748326" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; or&amp;nbsp;&lt;A href="https://community.jmp.com/t5/JMP-Wish-List/Substitute-First-Occurrence/idi-p/574766" target="_blank" rel="noopener"&gt;@Substitute First Occurence&amp;nbsp;&amp;nbsp;&lt;/A&gt;could even help JMP?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1727421944054.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68653iF17605CF349304EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1727421944054.png" alt="hogi_0-1727421944054.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The suggestions from JMP support:&lt;EM&gt;&lt;BR /&gt;There are a couple of other things you can do to prevent the crash.&amp;nbsp; One is to put the curly braces ({}) as a required argument in the internal function. Another is to remove the parentheses after the word Function in the internal function.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unfortunately no help for the application case from above.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 11:15:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802210#M97833</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-30T11:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong here?</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802236#M97841</link>
      <description>&lt;P&gt;A workaround :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;f = Function( {}, 
/* ....  */ 
	ID = Associative Array( {{"Name Expr()", 1}, {"Expr()", 2}, {"Function()", 3}}, 0 );
/* ....  */ 
);
f();
code = Expr(g = function ({x},1));
myID=ID[Char(Head(Arg(code,2)))]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;but it "hurts" a bit ...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1727423569763.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68656i8A626F25FEE18EBF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1727423569763.png" alt="hogi_1-1727423569763.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 07:53:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802236#M97841</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-27T07:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong here?</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802297#M97851</link>
      <description>&lt;P&gt;I like this one a lot more:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;f = Function( {}, 
/* ....  */ 
	Eval (Eval Expr(ID = Associative Array( {{Name Expr(), 1}, {Expr(Parse("Expr()")), 2}, {Expr(Parse("Function()")), 3}}, 0 )));
/* ....  */ 
);
f;
code = Expr(g = function ({x},1));
myID=ID[Head(Arg(code,2))];&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It can't work, after the &lt;FONT face="courier new,courier"&gt;eval expr&lt;/FONT&gt;&amp;nbsp;it will be more or less the same as before&amp;nbsp;...&lt;BR /&gt;... wow!&lt;BR /&gt;&lt;BR /&gt;NB:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Expr()&lt;/FONT&gt;won't survive the &lt;FONT face="courier new,courier"&gt;Eval Expr&lt;/FONT&gt; - so has to get protected.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 07:09:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802297#M97851</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-28T07:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong here?</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802298#M97852</link>
      <description>&lt;P&gt;&lt;STRIKE&gt;-&lt;/STRIKE&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 07:09:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802298#M97852</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-28T07:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong here? Expression issue in Formula()</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802319#M97856</link>
      <description>&lt;P&gt;I actually just submitted this bug report a few days ago! I found that using Expr(Function()) inside a function causes a crash. I was using it in the context of&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Substitute(my_expr, Expr(Function()), Expr(Method()))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But was able to get by using Expr(Function) instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your issue, another possible solution if you don't want to parse strings is do something like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;y = Function({head_key},
	ID = Associative Array( EvalList({{Name Expr(), 1}, {Expr(), 2}, EvalList({Head(Expr(Function({},1))), 3})}), 0 );
    ID[NameExpr(head_key)]
);
Show(y(Expr(Function())));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Although still not exactly 'pretty.'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 14:36:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802319#M97856</guid>
      <dc:creator>bculver</dc:creator>
      <dc:date>2024-09-27T14:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong here? Expression issue in Formula()</title>
      <link>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802335#M97858</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Head(Expr(Function()))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;nice!&lt;BR /&gt;much better than my &lt;FONT face="courier new,courier"&gt;Eval( ... Parse(&lt;/FONT&gt;&amp;nbsp; ...&amp;nbsp; &amp;nbsp;especially after citing Joseph's&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1727423569763.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68656i8A626F25FEE18EBF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1727423569763.png" alt="hogi_1-1727423569763.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 07:10:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-s-wrong-here-Expression-issue-in-Formula/m-p/802335#M97858</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-28T07:10:44Z</dc:date>
    </item>
  </channel>
</rss>

