関数 fun が True を返すすべてのメンバを削除し、 list のコピーを返します。
removeIf? ( fun As Name, _
list As List ) As List
引数 | [タイプ] | 説明 |
---|---|---|
fun | Name | 適用する関数の名前です。この関数は boolean を返す必要があります。 |
list | List | テスト関数が適用される引数の list をクリックします。 |
Intent >removeIf(empty?, { {:a}, {:b}, {}, {:d} })
--> {{:a}, {:b}, {:d}}
この例では、すべての空のサブリストが削除されます。 この場合、入力
list
で 3 番目の項目のみが削除されます。 Intent >removeIf(integer?, {:a, :c, "b", :c, 1.1, 3, :c, 3, 2, 1})
--> {:a, :c, "b", :c, 1.1, :c}
Function integer?(item as Any) as Boolean
integer? = (typeName(item) = :integer)
End Function
Intent >removeIf(:even?, {1, 2, 3, 4, 5, 6, 7, 8})
--> { 1, 3, 5, 7 }