t 型のオブジェクトが書き込まれる配列。オブジェクトは {
| self のクローンを返します。 |
| start で始まる length 要素を使って、self から新しい Sequence を作成します。 |
| いくつかの要素が選別された、self のクローンを返します。 |
| 要素のキー (インデックス) を基に要素が選別された、self のクローンを返します。 |
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 のクローンを返します。
戻り値
例
| 例 | |
{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
}
|
注意事項