<?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: List of expressions in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41662#M24296</link>
    <description>&lt;P&gt;The "best way?" Are you trying to start a fight in the JMP Community?&lt;/P&gt;
&lt;P&gt;There is more than one way to solve this problem. The decision about which way is the best depends on several criteria. Here is another candidate solution that is different from Jim's solution but not necessarily any better.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// List the variable names
name list = { "Cool", "Awesome", "Bad" };

// List the variable values
value list = { 1, 2, 3 };

// Prepare an empty container for assignments
name value list = {};

// Make the list of assignments
For( i = 1, i &amp;lt;= N Items( name list ), i++,
	// Start with function with no arguments
	assign expr = Expr( Assign() );
	// Add first argument
	Insert Into( assign expr, name list[i] );
	// Add second argument
	Insert Into( assign expr, value list[i] );
	// Add function to assignment list
	Insert Into( name value list, Name Expr( assign expr ) );
);

Show( name value list );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you have a choice. (I bet you have another any moment.) You choose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2017 17:15:35 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2017-07-07T17:15:35Z</dc:date>
    <item>
      <title>List of expressions</title>
      <link>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41652#M24291</link>
      <description>&lt;P&gt;I'd like to build up&amp;nbsp;a list&amp;nbsp;that looks like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LL =&amp;nbsp;{parm1 = "x", value1 = 5, parm2 = "y", value2 = 3, ...}&lt;/P&gt;&lt;P&gt;The length may vary, so I'm doing it in a loop and trying to use the loop index in the variable name.&lt;/P&gt;&lt;P&gt;But I am having difficulty creating that term (e.g. parm1).&lt;/P&gt;&lt;P&gt;What is the best way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 15:38:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41652#M24291</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2017-07-07T15:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: List of expressions</title>
      <link>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41655#M24292</link>
      <description>&lt;P&gt;Here is a similar piece of code to generate a list&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = New Table( "Untitled 36", Add Rows( 3 ), 
	New Column( "Column 1", Character, "Nominal", 
	Set Values( {"1", "2", "3"} ) ) );

NamesList = {"Cool", "Awsome", "Bad"};
	
ValuesList = Column( dt, 1 ) &amp;lt;&amp;lt; get values;

NamesValuesList = {};

// Build the Value Labels List
For( i = 1, i &amp;lt;= N Items( NamesList ), i++,
	Insert Into( namesvalueslist, 
		Parse( ValuesList[i] || " = \!"" || NamesList[i] || "\!"" ) )
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jul 2017 15:49:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41655#M24292</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-07-07T15:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: List of expressions</title>
      <link>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41662#M24296</link>
      <description>&lt;P&gt;The "best way?" Are you trying to start a fight in the JMP Community?&lt;/P&gt;
&lt;P&gt;There is more than one way to solve this problem. The decision about which way is the best depends on several criteria. Here is another candidate solution that is different from Jim's solution but not necessarily any better.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// List the variable names
name list = { "Cool", "Awesome", "Bad" };

// List the variable values
value list = { 1, 2, 3 };

// Prepare an empty container for assignments
name value list = {};

// Make the list of assignments
For( i = 1, i &amp;lt;= N Items( name list ), i++,
	// Start with function with no arguments
	assign expr = Expr( Assign() );
	// Add first argument
	Insert Into( assign expr, name list[i] );
	// Add second argument
	Insert Into( assign expr, value list[i] );
	// Add function to assignment list
	Insert Into( name value list, Name Expr( assign expr ) );
);

Show( name value list );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you have a choice. (I bet you have another any moment.) You choose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 17:15:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41662#M24296</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2017-07-07T17:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: List of expressions</title>
      <link>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41665#M24298</link>
      <description>&lt;P&gt;I will not rate which is best.&amp;nbsp; But I did find both examples useful to understand how it all works.&lt;/P&gt;&lt;P&gt;In the end my code looked like this.&amp;nbsp; Note: this will not run as is since I don't define some things here.&lt;/P&gt;&lt;P&gt;This is in a loop with index k.&amp;nbsp; A list of list stores all the results.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;LList = {};&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;Insert Into&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(LList,&lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;Parse&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(&lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"TestParam"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;||&lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;char&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(k)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"=\!""&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;||Modes[k]||&lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"\!""&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)); &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//&amp;nbsp;Test Param Name&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;Insert Into&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(LList,&lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;Parse&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(&lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"FitParam"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;||&lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;char&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(k)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"=\!""&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;||dtStats[&lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;]||&lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"\!""&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)); &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//&amp;nbsp;Fit Param Name&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;Insert Into&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(LList,&lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;Parse&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(&lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"Rsq"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;||&lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;char&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(k)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"="&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;||&lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;char&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(dtStats[&lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;3&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;]))); &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// Rsquared&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 18:47:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41665#M24298</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2017-07-07T18:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: List of expressions</title>
      <link>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41666#M24299</link>
      <description>&lt;P&gt;it really looks to me like you could do a list of associative arrays or nested associative arrays if you want. &amp;nbsp;Then you don't have to Parse Strings in order to create your data structure and I find it WAY easier to read (when you parse strings to create variables, you lose the ability to just run them or mouse over in order to see them. )&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);

testparam1 = 1;
fitparam1 = 2;
Rsq1 = 3;
testparam2 = 4;
fitparam2 = 5;
Rsq2 = 6;

//list of associative arrays
Laa = {};
//param1 insert
insert into(Laa, associative array({"TestParam", "FitParam", "Rsq"}, Evallist({testparam1, fitparam1, Rsq1})) );
//param2 insert
insert into(Laa, associative array({"TestParam", "FitParam", "Rsq"}, Evallist({testparam2, fitparam2, Rsq2})) );

show(Laa[1]["TestParam"], Laa[2]["TestParam"]);

//nested associative arrays

Naa = associative array();
//param1 insert
Naa["name1"] = associative array({"TestParam", "FitParam", "Rsq"}, Evallist({testparam1, fitparam1, Rsq1}));
//param2 insert
Naa["name2"] = associative array({"TestParam", "FitParam", "Rsq"}, Evallist({testparam2, fitparam2, Rsq2}));

show(Naa["name1"]["FitParam"], Naa["name2"]["FitParam"]);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;returns&lt;/P&gt;
&lt;P&gt;Laa[1]["TestParam"] = 1;&lt;BR /&gt;Laa[2]["TestParam"] = 4;&lt;BR /&gt;Naa["name1"]["FitParam"] = 2;&lt;BR /&gt;Naa["name2"]["FitParam"] = 5;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the benefit of the nested really only being if you expect that order would change and position matters.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 19:10:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41666#M24299</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2017-07-07T19:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: List of expressions</title>
      <link>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41669#M24302</link>
      <description>&lt;P&gt;Here's another way to do it. &amp;nbsp;Similar to your final solution.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//      LL = {parm1 = "x", value1 = 5, parm2 = "y", value2 = 3, ...}

// Assume parameters and value labels are sequential
parm_list  = {"x", "y", "z"};
value_list = {5, 3, 1};

pval_list = {};

for (i = 1, i &amp;lt;= nitems(parm_list), i++,
	one_parm = evalinsert("\[parm^i^ = "^parm_list[i]^"]\");
	one_val  = evalinsert("\[value^i^ = ^value_list[i]^]\");
	
	insertinto(pval_list, parse(one_parm));
	insertinto(pval_list, parse(one_val));
);

pval_list;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jul 2017 19:26:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/List-of-expressions/m-p/41669#M24302</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2017-07-07T19:26:09Z</dc:date>
    </item>
  </channel>
</rss>

