1 次元配列のパラメータ化クラス。
説明
注意事項
注意事項
注意事項
要素の 1 次元配列を初期化します。 |
要素の 1 次元配列を初期化します。 |
要素の 1 次元配列を初期化します。 |
要素の 1 次元配列を初期化します。 |
self の efficient-size を取得または設定します。 |
self の (要素数など) サイズを取得します。 |
データを格納する基本 |
self の最後に e を追加します。 |
self からすべての要素を削除します。 |
self のクローンを返します。 |
start で始まる length 要素を使って、self から新しい Sequence を作成します。 |
self の最後に s1 を連結します。 |
構造的に等価であるかを調べるために、メソッドの引数と Self を比較します。 |
いくつかの要素が選別された、self のクローンを返します。 |
要素のキー (インデックス) を基に要素が選別された、self のクローンを返します。 |
特定の要素を返します。 |
特定の値、および示された要素が発見されたかどうかを示す bool を返します。 |
メソッドの引数が self の有効なインデックスであるかどうかを示します。 |
self 内の index で指定された位置の直前に e を挿入します。 |
クラス インスタンスが書き込まれるときに、シリアル化コードで呼び出されます。 |
self の最後から要素を削除して返します。 |
self の最後に e をプッシュします。 |
self から 1 つまたは複数の連続する要素を削除します。 |
self 内の要素の順序を逆にします。 |
特定のインデックスの要素を設定します。 |
self のサイズを設定します。 |
self の要素をソートします。採用されているのは、安定なソート アルゴリズムです。つまり、同等の要素の相対的な順序は変更しません。 |
index で指定された位置の直前で s1 を self にスプライスします。 |
スタックとして見たときに self の最上位にある要素を、self を変更しないで返します。これはシーケンスの最後の要素です。 |
要素の 1 次元配列を初期化します。
要素の 1 次元配列を初期化します。
例
{let my-array:{Array-of String} = {new {Array-of String}}}
{let my-array:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry"}}
要素の 1 次元配列を初期化します。
要素の 1 次元配列を初期化します。
self の (要素数など) サイズを取得します。
データを格納する基本
self の最後に e を追加します。
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Append an element to the end of the array. {my-array.append "Sally"} || Use a VBox to display the contents of price. || Add each element to the VBox, then display || the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
注意事項
self からすべての要素を削除します。
例
例 | |
{value || Declare and initialize my-array (an array || of String). let my-array:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry"} || Clear the array. {my-array.clear} || Check if the array is empty. {text The array is empty is... {value my-array.empty?}} } |
self のクローンを返します。
戻り値
説明
例
例 | |
{value || Declare and initialize array-1 (the || original array). let array-1:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry"} || Initialize array-2 with a clone of the || contents of array-1. let array-2:{Array-of String} = {array-1.clone} || Use a VBox to display the contents of array-2. || Iterate over the contents of array-2, adding || them to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in array-2 do {message.add each-element} } message } |
注意事項
start で始まる length 要素を使って、self から新しい Sequence を作成します。
例
例 | |
{value || Declare and initialize array-1 (the || original array). let array-1:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry", "plum"} || Declare and initialize array-2 with a clone of the || two elements starting at index 1 of array-1. let array-2:{Array-of String} = {array-1.clone-range 1, 2} || Use a VBox to display the contents of array-2. || Iterate over the contents of array-2, adding || them to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in array-2 do {message.add each-element} } message } |
注意事項
self の最後に s1 を連結します。
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Declare and initialize another array with || String elements. let your-array:{Array-of String} = {new {Array-of String}, "Mary", "Sally"} || Concatenate the elements of your-array onto || the end of my-array. {my-array.concat your-array} || Use a VBox to display the contents of my-array. || For each key in my-array, add an HBox to the VBox. || The HBox contains the relevant key and element. || Then display the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
注意事項
構造的に等価であるかを調べるために、メソッドの引数と Self を比較します。
戻り値
説明
例
例 | |
|| Declare and initialize array-1 (an array || of String) with three elements. {let array-1:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry"} } || Declare and initialize array-2 (an array || of String) with two elements. {let array-2:{Array-of String} = {new {Array-of String}, "apple", "banana"} } || Determine if the arrays are equal. The arrays are equal is... {array-1.equal? array-2} || Add an element to array-2. {array-2.append "cherry"} || And test the arrays for equality again. After the append operation, the arrays are equal is... {array-1.equal? array-2} |
いくつかの要素が選別された、self のクローンを返します。
戻り値
例
例 | |
{value || Declare and initialize array-1 (an array || of String). let array-1:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry"} || Create a clone array-2 that contains the elements || of array-1 with strings that begin with the letter || 'a' filtered out. let array-2:{Array-of String} = {array-1.filter-clone {proc {str:String}:bool {return str[0] != 'a'} } } || Use a VBox to display the contents of array-2. || Iterate over the contents of array-2, adding them || to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in array-2 do {message.add each-element} } message } |
注意事項
要素のキー (インデックス) を基に要素が選別された、self のクローンを返します。
戻り値
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Create a clone that contains the elements of the || original, except that elements with even keys are || filtered out. let new-array:{Array-of String} = {my-array.filter-keys-clone {proc {index:int}:bool {return (index mod 2) == 0} } } || Use a VBox to display the contents of new-array. || Add each element to the VBox, then display || the VBox. let message:VBox = {VBox} {for each-element:String in new-array do {message.add each-element} } message } |
注意事項
特定の要素を返します。
戻り値
例
例 | |
|| Declare and initialize an array with String || elements. {let my-array:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry" } } || Display the element at index 2. {my-array.get 2} |
注意事項
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry" } || Display the element at index 2. my-array[2] } |
特定の値、および示された要素が発見されたかどうかを示す bool を返します。
戻り値
注意事項
メソッドの引数が self の有効なインデックスであるかどうかを示します。
戻り値
説明
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Check if there is an element at index 3. || Remember that the first element in an array || is at index 0. {if {my-array.in-bounds? 3} then {text It is there!} else {text It is not there.} } } |
注意事項
self 内の index で指定された位置の直前に e を挿入します。
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Insert an element at position 1. Subsequent || elements are shifted one position to the right. {my-array.insert "Mary", 1} || Insert an element at position 4. {my-array.insert "Sally", 4} || Use a VBox to display the contents of price. || Add each element to the VBox, then display || the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
注意事項
クラス インスタンスが書き込まれるときに、シリアル化コードで呼び出されます。
説明
注意事項
self の最後から要素を削除して返します。
説明
例
例: スタックから要素をポップ | |
|| Declare and initialize an array with String || elements. {let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"}} || Pop an element from the array. {text The return value of a pop operation is...} {my-array.pop} || Use a VBox to display the contents of my-array. || Add each element to the VBox, then embed the || VBox within another for display. {let message:VBox = {VBox}} {for each-element:String in my-array do {message.add each-element} } {VBox {text After the pop operation, the array has the following elements...}, {value message} } |
注意事項
self の最後に e をプッシュします。
説明
例
例: スタックに要素をプッシュ | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Append an element to the end of the array. {my-array.push "Sally"} || Use a VBox to display the contents of my-array. || Add each element to the VBox, then display || the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
注意事項
self から 1 つまたは複数の連続する要素を削除します。
説明
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry" } || Remove the element at index 1. {my-array.remove 1} || Use a VBox to display the contents of my-array. || For each element in my-array, add a string to the || VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
self 内の要素の順序を逆にします。
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Reverse the order of the elements. {my-array.reverse} || Use a VBox to display the contents of price. || Add each element to the VBox, then display || the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
注意事項
特定のインデックスの要素を設定します。
説明
例
例 | |
|| Declare and initialize a hash table with || String keys and int elements. || Declare and initialize an array with String || elements. {let my-array:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry" } } || Set the element at index 1 to "plum". {my-array.set 1, "plum"} || Use a VBox to display the contents of my-array. || For each element in my-array, add an HBox to the || VBox. The HBox contains the relevant index and || element. Then display the VBox. {let message:VBox = {VBox}} {for key each-element:int in my-array do {message.add {HBox each-element, " ", {my-array.get each-element}}} } {value message} |
注意事項
例 | |
|| Declare and initialize an array with String || elements. {let my-array:{Array-of String} = {new {Array-of String}, "apple", "banana", "cherry" } } || Set the element at index 1 to "plum". {set my-array[1] = "plum"} || Use a VBox to display the contents of my-array. || For each element in my-array, add an HBox to the || VBox. The HBox contains the relevant index and || element. Then display the VBox. {let message:VBox = {VBox}} {for key each-element:int in my-array do {message.add {HBox each-element, " ", {my-array.get each-element}}} } {value message} |
self のサイズを設定します。
注意事項
self の要素をソートします。採用されているのは、安定なソート アルゴリズムです。つまり、同等の要素の相対的な順序は変更しません。
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Sort the elements. {my-array.sort} || Use a VBox to display the contents of price. || Add each element to the VBox, then display || the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
例 | |
{value || Declare and initialize an array with int || elements. let my-array:{Array-of int} = {new {Array-of int}, 7, 69, 13, 33, 22} || Sort the elements into descending order. {my-array.sort comparison-proc = {proc {x:int, y:int}:bool {return x > y} } } || Use a VBox to display the contents of my-array. || Then display the VBox. let message:VBox = {VBox} {for each-element:int in my-array do {message.add each-element} } message } |
注意事項
index で指定された位置の直前で s1 を self にスプライスします。
例
例 | |
{value || Declare and initialize an array with String || elements. let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} || Declare and initialize another array with || String elements. let your-array:{Array-of String} = {new {Array-of String}, "Mary", "Sally"} || Insert the elements of your-array into my-array || at index 1. Subsequent elements of my-array || are shifted to the right. {my-array.splice your-array, 1} || Use a VBox to display the contents of my-array. || For each key in my-array, add an HBox to the VBox. || The HBox contains the relevant key and element. || Then display the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
注意事項
スタックとして見たときに self の最上位にある要素を、self を変更しないで返します。これはシーケンスの最後の要素です。
戻り値
説明
例
例: スタックの上部の要素を取得します。 | |
|| Declare and initialize an array with String || elements. {let my-array:{Array-of String} = {new {Array-of String}, "Tom", "Dick", "Harry"} } || View the top of the stack. {text The return value of a top-of-stack operation is...} {my-array.top-of-stack} || Use a VBox to display the contents of my-array. || Add each element to the VBox, then embed the || VBox within another for display. {let message:VBox = {VBox}} {for each-element:String in my-array do {message.add each-element} } {VBox {text After the top-of-stack operation, the array has the following elements...}, {value message} } |
注意事項