AnyMatch
例題
すべて開く すべて閉じる例 (4)
リストの任意の要素がパターンにマッチするかどうかを検証する:
AnyMatch[{x ^ 2, y ^ 3, x ^ 5, x ^ 6}, y ^ _]AnyMatch[{a, b, b, a, a, a}, _Integer]AnyMatch[{{a, 1, c}, {2, e, 3}}, _Integer, 2]AnyMatch[{{a, b, c}, {d, e, f}}, _Integer, 2]AnyMatchの演算子形を使う:
AnyMatch[_Integer][{1, 1, f[a], 2, 3, y, f[8], 9, f[10]}]連想の任意の値がパターンにマッチするかどうかをチェックする:
AnyMatch[<|"a" -> 1, "b" -> b, "c" -> 3|>, _Symbol]スコープ (4)
AnyMatchは任意の頭部を持つ式に適用できる:
AnyMatch[f[a, 1, b], _Integer]AnyMatchは,不揃いの式にも動作する:
AnyMatch[{{a, 1, c}, {2, e}}, _Integer, 2]AnyMatch[f[{a, 1, c}, {2, e}], _Integer, 2]デフォルトで,AnyMatchはレベル1に作用する:
AnyMatch[4, _Integer]AnyMatch[{}, _Integer]AnyMatch[4, _Integer, 0]Verbatimを使ってリテラルなブランクを検証する:
AnyMatch[f[a, _, c], Verbatim[_]]特性と関係 (6)
AnyMatch[list,form]は!NoneMatch[list,form]に等しい:
{AnyMatch[{a, 1, c, 2, e}, _Integer], !NoneMatch[{a, 1, c, 2, e}, _Integer]}AnyMatch[list,form]は疎なベクトルに効率的に作用する:
AnyMatch[SparseArray[{1000 -> a}, {1000000000000}], _Symbol]//EchoTimingAnyMatch[list,form]は list の各部分を順にチェックし,form がマッチしなくなると停止する:
AnyMatch[{1, 2, 3, 4, 5}, _ ? (EvenQ @* Echo)]AnyMatch[list,form]はAnyTrue[list,MatchQ[form]]に等しい:
{AnyMatch[{1, 2, 3, 4, 5}, _Integer], AnyTrue[{1, 2, 3, 4, 5}, MatchQ[_Integer]]}AnyMatch[{e1,e2,…},form]はOr[MatchQ[e1,form],MatchQ[e2,form],…]に等しい:
{AnyMatch[{a, 1, b}, _Integer], MatchQ[a, _Integer] || MatchQ[1, _Integer] || MatchQ[b, _Integer]}AnyMatch[list,e1|e2|…]はContainsAny[list,{e1,e2,…}]に等しい:
{AnyMatch[{a, a, b, c, a}, a | b], ContainsAny[{a, a, b, c, a}, {a, b}]}考えられる問題 (1)
AnyMatchは,連想に関しては値しか検証しない:
AnyMatch[<|a -> 1|>, 1]AnyMatch[<|a -> 1|>, a]関連するガイド
-
▪
- パターンマッチング関数 ▪
- リスト操作 ▪
- リストの要素 ▪
- 判定式 ▪
- 関数の合成と演算子形式 ▪
- 集合の操作
テキスト
Wolfram Research (2024), AnyMatch, Wolfram言語関数, https://reference.wolfram.com/language/ref/AnyMatch.html.
CMS
Wolfram Language. 2024. "AnyMatch." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AnyMatch.html.
APA
Wolfram Language. (2024). AnyMatch. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AnyMatch.html
BibTeX
@misc{reference.wolfram_2026_anymatch, author="Wolfram Research", title="{AnyMatch}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/AnyMatch.html}", note=[Accessed: 11-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_anymatch, organization={Wolfram Research}, title={AnyMatch}, year={2024}, url={https://reference.wolfram.com/language/ref/AnyMatch.html}, note=[Accessed: 11-August-2026]}