def cross-product [...tables] { 05/12/2026 08:21:49 PM let indexed = ( $tables | enumerate | each { |t| let prefix = $"t($t.index)_" $t.item | rename --block { |col| $"($prefix)($col)" } } ) $indexed | reduce --fold [ ] { |table, acc| if ($acc | is-empty) { $table } else { $acc | each { |row| $table | each { |other| $row | merge $other } } | flatten } } }