<?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 Making an associative array with values having expression evaluation results in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630331#M82849</link>
    <description>&lt;P&gt;As usual I'm having trouble with Eval and Expr.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create an associative array where values would be evaluated results of some expressions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance I need to create&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa=[
"2x2" =&amp;gt; 4
]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but 4 there is a result of evaluated expression Expr(2*2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lame variant that obviously doesn't work is here:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa=[
"2x2" =&amp;gt; 2*2
]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But then I'll say that 2*2 is an Expr:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa=[
"2x2" =&amp;gt; Expr(2*2)
]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and then I'll use Eval Expr to evaluate all expressions inside the argument and return expression with evaluated subexpressions:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval Expr(
aaa=[
"2x2" =&amp;gt; Expr(2*2)
]
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and it already doesn't work - it doesn't evaluate Expr(2*2)&lt;/P&gt;&lt;P&gt;The next step would be to evaluate resultant expression:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval(
Eval Expr(
aaa=[
"2x2" =&amp;gt; Expr(2*2)
]
)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but obviously it doesn't work.&lt;/P&gt;&lt;P&gt;Why does it not work and what is the correct way?&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;</description>
    <pubDate>Fri, 09 Jun 2023 16:09:39 GMT</pubDate>
    <dc:creator>miguello</dc:creator>
    <dc:date>2023-06-09T16:09:39Z</dc:date>
    <item>
      <title>Making an associative array with values having expression evaluation results</title>
      <link>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630331#M82849</link>
      <description>&lt;P&gt;As usual I'm having trouble with Eval and Expr.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create an associative array where values would be evaluated results of some expressions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance I need to create&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa=[
"2x2" =&amp;gt; 4
]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but 4 there is a result of evaluated expression Expr(2*2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lame variant that obviously doesn't work is here:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa=[
"2x2" =&amp;gt; 2*2
]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But then I'll say that 2*2 is an Expr:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa=[
"2x2" =&amp;gt; Expr(2*2)
]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and then I'll use Eval Expr to evaluate all expressions inside the argument and return expression with evaluated subexpressions:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval Expr(
aaa=[
"2x2" =&amp;gt; Expr(2*2)
]
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and it already doesn't work - it doesn't evaluate Expr(2*2)&lt;/P&gt;&lt;P&gt;The next step would be to evaluate resultant expression:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval(
Eval Expr(
aaa=[
"2x2" =&amp;gt; Expr(2*2)
]
)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but obviously it doesn't work.&lt;/P&gt;&lt;P&gt;Why does it not work and what is the correct way?&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;</description>
      <pubDate>Fri, 09 Jun 2023 16:09:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630331#M82849</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-06-09T16:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Making an associative array with values having expression evaluation results</title>
      <link>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630393#M82855</link>
      <description>&lt;P&gt;JMP is nothing if not inconsistent.&amp;nbsp; You can do it via lists, which is what I do in these circumstances:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;val1 = "Steve";
val2 = "The";
val3 = "Turtle";
aaa = Associative Array(
	{"key1", "key2", "key3"},
	Eval List( {val1, val2, val3} )
);

show( aaa )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 May 2023 23:38:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630393#M82855</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2023-05-09T23:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Making an associative array with values having expression evaluation results</title>
      <link>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630405#M82856</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Why does it not work&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The square bracket form is a compile time constant, both for arrays and associative arrays. The constant between the square brackets is cloned at run time and stored into aaa.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26363"&gt;@ErraticAttack&lt;/a&gt;&amp;nbsp; is the way I'd do it too.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 01:10:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630405#M82856</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-05-10T01:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Making an associative array with values having expression evaluation results</title>
      <link>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630432#M82859</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;&amp;nbsp;&amp;nbsp;Good to know!&amp;nbsp; Sounds like you have some behind-the-scenes development experience on this!&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 05:35:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630432#M82859</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2023-05-10T05:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Making an associative array with values having expression evaluation results</title>
      <link>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630676#M82889</link>
      <description>&lt;P&gt;Ok, understood. I thought that it was Associative Array specific, but looks like it is syntax specific :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 18:21:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Making-an-associative-array-with-values-having-expression/m-p/630676#M82889</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-05-10T18:21:12Z</dc:date>
    </item>
  </channel>
</rss>

