nu-modules/it.nu

11 lines
335 B
Plaintext

# zip two lists producing a table where the 'key' list are the keys.
export def "zip-keys" [ # -> list<any>
keys: list<any>
] {
zip $keys | reduce -f {} { |it, acc| $acc | upsert $it.1 $it.0 }
}
# split a table into equally sized chunks
export def chunk [chunk_size:int] {
window $chunk_size --stride $chunk_size -r
}