{"id":"dict-dispatch-over-conditionals","text":"`countMatches` maps string keys to positional indices via a dictionary literal (`{\"type\": 0, \"color\": 1, \"name\": 2}[ruleKey]`) rather than an if/elif chain — a pattern worth checking for reuse in other key-to-index solutions.","truth_value":"IN","source":"entries/2026/06/06/count-items-matching-a-rule-solution.md","source_url":"","source_hash":"","justifications":[],"dependents":[],"metadata":{},"created_at":"","updated_at":"","reviewed_at":"","verified_at":"","retracted_at":"","explanation":{"steps":[{"node":"dict-dispatch-over-conditionals","truth_value":"IN","reason":"premise"}]}}