公開日: 11/25/2021

リストの連結

2つ以上のリストを1つのリストに連結するには、Concat()または||演算子を使用します。元のリストは変更されません。

次の例は、Concat()を使ってリストaとリストbを連結しています。

a = {1, 2};
b = {7, 8, 9};
Concat( a, b );

{1, 2, 7, 8, 9}

次の例は、同じ2つのリストを||演算子を使って連結しています。

{1, 2} || {7, 8, 9}

{1, 2, 7, 8, 9}

異なる種類(文字列のリストと数値のリストなど)を連結することもできます。

d = {"apples", "bananas"};
e = {"oranges", "grapes"};
f = {1, 2, 3};
Concat( d, e, f);

{"apples", "bananas", "oranges", "grapes", 1, 2, 3}

2つ以上のリストを連結し、最初のリストを連結後のリストに置き換えるには、Concat to()または||=演算子を使用します。次の例では、Concat to()を使用して連結を実行しています。

d = {"apples", "bananas"};
e = {"peaches", "pears"};
Concat to(d,e);
Show( d );

d = {"apples", "bananas", "peaches", "pears"}

次の例は、同じ2つのリストを||=演算子を使って連結しています。

d = {"apples", "bananas"};
e = {"peaches", "pears"};
d||=e;
Show( d );

d = {"apples", "bananas", "peaches", "pears"}

より詳細な情報が必要な場合や、質問があるときは、JMPユーザーコミュニティで答えを見つけましょう (community.jmp.com).