Something went wrong. Try again.
nushell cross product for tables
Something went wrong. Try again.
562 B · 24 lines · Created 5mo ago
Nushell
12345678910111213141516171819202122232425def 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 } }}