<?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: How to index list with a nested list in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631665#M83004</link>
    <description>&lt;P&gt;This is technically a loop but will also work (assuming you've got lis = the list of values and combinations = the nchoosek matrix of pairs)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;i = 1;
res = Repeat( { lis[ combinations[ i++, 0 ] ] } , N Items( lis ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 13 May 2023 13:46:08 GMT</pubDate>
    <dc:creator>brady_brady</dc:creator>
    <dc:date>2023-05-13T13:46:08Z</dc:date>
    <item>
      <title>How to index list with a nested list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631174#M82944</link>
      <description>&lt;P&gt;Based on&amp;nbsp;&lt;A href="https://community.jmp.com/t5/Discussions/Combinations-of-a-list-put-into-columns/m-p/555454" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Combinations-of-a-list-put-into-columns/m-p/555454&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;list = {"A", "B", "C"}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need based on that make a list of all pair combinations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Link above helped me to get away from long cycles or joining tables into essentially a one-liner thanks to&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3552"&gt;@brady_brady&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this so far:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;list = {"A", "B", "C"};
combinations = As List(N Choose K Matrix(N Items(list), 2));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What it does it gives me a list of lists of INDICES&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;{{1, 2}, {1, 3}, {2, 3}}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and what I need is list of pairs of strings:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;{{"A", "B"},{"A", "C"},{"B", "C"}}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;without&amp;nbsp;going&amp;nbsp;into&amp;nbsp;cycles&amp;nbsp;is&amp;nbsp;there&amp;nbsp;another&amp;nbsp;one-liner&amp;nbsp;that&amp;nbsp;would do that?&lt;/P&gt;&lt;P&gt;Just indexing list with combinations gives me a flat list&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;list[combinations]
{"A", "B", "A", "C", "B", "C"}&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 16:09:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631174#M82944</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-06-09T16:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to index list with a nested list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631190#M82946</link>
      <description>&lt;P&gt;I think you could do it with substitute&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

l = {"A", "B", "C"};
combinations = As List(N Choose K Matrix(N Items(l), 2));
a = Substitute(combinations, 1 ,"A", 2, "B", 3, "C");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but looping is more clear in my opinion&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 19:43:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631190#M82946</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-05-11T19:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to index list with a nested list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631193#M82947</link>
      <description>&lt;P&gt;Yeah, the list is not known at the compile time, so I guess I'll have to do it through loops.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 19:56:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631193#M82947</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-05-11T19:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to index list with a nested list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631196#M82948</link>
      <description>&lt;P&gt;I think something like this should work with Transform Each&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;l1 = Transform Each({idx}, combinations, l[idx]);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 May 2023 20:03:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631196#M82948</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-05-11T20:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to index list with a nested list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631665#M83004</link>
      <description>&lt;P&gt;This is technically a loop but will also work (assuming you've got lis = the list of values and combinations = the nchoosek matrix of pairs)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;i = 1;
res = Repeat( { lis[ combinations[ i++, 0 ] ] } , N Items( lis ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 13:46:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-index-list-with-a-nested-list/m-p/631665#M83004</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2023-05-13T13:46:08Z</dc:date>
    </item>
  </channel>
</rss>

