Since patterns are not a nested structure, you can just use `iterator_to_array()` here; I'll make that change on merge.