関数 fun が True を返すすべてのメンバを削除し、一覧のコピーを返します。
removeIf? ( fun As Name, _ list As List ) As List
引数 | [タイプ] | 説明 |
---|---|---|
fun | [名前] | 適用する関数の名前です。この関数は、ブール値を返す必要があります。 |
list | [一覧] | テスト関数が適用される引数の一覧です。 |
Intent >removeIf(empty?, { {:a}, {:b}, {}, {:d} }) --> {{:a}, {:b}, {:d}}この例では、すべての空のサブリストが削除されます。この場合、入力一覧の 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 }