(fn split [pattern str] (let [res []] (each [seg (str:gmatch pattern)] (table.insert res seg)) res)) {: split}