Re: 連想配列 (JSL のデータ辞書) の既存のキーに追加の値を挿入する価値を扱うex["b"]他のリストと同様です。
Names Default To Here( 1 );
ex = Associative Array();
ex["a"] = {"10"};
ex["b"] = {"20"};
ex["c"] = {"30"};
// Add new value to "b"
Insert Into( ex["b"], {"21"} );
Show( ex );Re: 連想配列 (JSL のデータ辞書) の既存のキーに追加の値を挿入する私は実際にこのようなものを使用しているので、変数の評価が欠落していると思います:
Names Default To Here( 1 );
ex = Associative Array();
a_s = "a";
b_s = "b";
c_s = "c";
a_n = "10";
b_n = "20";
c_n = "30";
ex[a_s] = {a_n};
ex[b_s] = {b_n};
ex[c_s] = {c_n};
// Add new value to "b"
b_n = "21";
Insert Into( ex[b_s], {b_n} );
Show( ex );
// ex = ["a" => {a_n}, "b" => {b_n, b_n}, "c" => {c_n}];
Re: 連想配列 (JSL のデータ辞書) の既存のキーに追加の値を挿入するマークの答えは最高です。 このようにすることもできます
ex["c"][nitems(ex["c"])+1]="99";
これは醜く、遅く、簡潔ではありません。 しかし、それは他の可能性を示唆しているかもしれません。 リストには、one-beyond-the-end の優れた添え字プロパティがあり、リストを 1 要素だけ拡張できます。
Re: 連想配列 (JSL のデータ辞書) の既存のキーに追加の値を挿入するlist の定義は、それらが評価されないことを示しています。
List: アイテムを評価せずにリストを作成します。
それらを evallist() でラップするだけです
Names Default To Here( 1 );
ex = Associative Array();
a_s = "a";
b_s = "b";
c_s = "c";
a_n = "10";
b_n = "20";
c_n = "30";
ex[a_s] = Evallist({a_n});
ex[b_s] = Evallist({b_n});
ex[c_s] = Evallist({c_n});
// Add new value to "b"
b_n = "21";
Insert Into( ex[b_s], Evallist({b_n}) );<BR />// or you could this it seems easier.
// Insert Into( ex[b_s], b_n) ;<BR />
Show( ex );Re: 連想配列 (JSL のデータ辞書) の既存のキーに追加の値を挿入するこれは機能しますが、特定のキーが存在しない場合、新しい要素を挿入することはできません。
キーが既に存在するかどうかに関係なく、新しいキーを導入する簡単な方法はありますか->値または新しい値を挿入しますか?
Re: 連想配列 (JSL のデータ辞書) の既存のキーに追加の値を挿入するif ステートメントを使用してキーが存在するかどうかを確認し、存在しない場合は作成する必要があると思います。 私は通常、空のリストを作成してこれを行い、その後、新しい要素を既存のリストに追加するコードに入ります。Re: 連想配列 (JSL のデータ辞書) の既存のキーに追加の値を挿入する以下を含む完全な例明らかその方法いいえ正しく動作します。
// I wish the default value for AA's worked correctly with a list for the
// default, but it does not:
aa = [=> {}];
Insert Into( aa["fred"], 1 );
Insert Into( aa["ralph"], 2 );
Show( aa ); // aa = [=> {1, 2}]; ?!?!?!?!
// so you must do an explicit test and create the key/list like this:
aa = [=> ];
For( i = 1, i <= 3, i += 1,
For Each( {key}, {"fred", "ralph"},
If( !(aa << Contains( key )), // key does not exist?
aa[key] = {};// add the key with an empty list
);
Insert Into( aa[key], i );// insert into list
)
);
Show( aa ); // aa = ["fred" => {1, 2, 3}, "ralph" => {1, 2, 3}];
連想配列 (JSL のデータ ディクショナリ) 内の既存のキーに追加の値を挿入する連想配列の既存のキーに新しい値を追加する適切な方法が見つかりません。
Names Default To Here( 1 );
ex = Associative Array();
ex["a"] = {"10"};
ex["b"] = {"20"};
ex["c"] = {"30"};
<BR />// Add new value to "b"
ex["b"] = {"21"};
show(ex);
//ex = ["a" => {"10"}, "b" => {"21"}, "c" => {"30"}];
// Solution needed
//ex = ["a" => {"10"}, "b" => {"20", "21"}, "c" => {"30"}];高度な統計モデリングデータのブレンディングとクリーンアップ