| import typing as t | |
| def chi(multi_set: list[str], other_multi_set: list[str], match_function: t.Callable) -> bool: | |
| assert len(multi_set) == len(other_multi_set), "Wrong input match lengths!" | |
| for item in multi_set: | |
| for other_item in other_multi_set: | |
| if match_function(item, other_item): | |
| return True | |
| return False | |
| def mu(multi_set: list[str], other_multi_set: list[str], match_function: t.Callable) -> int: | |
| assert len(multi_set) == len(other_multi_set), "Wrong input match lengths!" | |
| count_intersections = 0 | |
| for item in multi_set: | |
| for other_item in other_multi_set: | |
| if match_function(item, other_item): | |
| count_intersections += 1 | |
| return count_intersections | |