zip for filters

Combine a stream with the input.

Signature

> zip {flags} (other)

Parameters

  • other: The other input.

Input/output types:

inputoutput
list<any>list<list<any>>
rangelist<list<any>>

Examples

Zip two lists

> [1 2] | zip [3 4]
╭───┬───────────╮
 0  ╭───┬───╮ 
     0  1  
     1  3  
    ╰───┴───╯ 
 1  ╭───┬───╮ 
     0  2  
     1  4  
    ╰───┴───╯ 
╰───┴───────────╯

Zip two ranges

> 1..3 | zip 4..6
╭───┬───────────╮
 0  ╭───┬───╮ 
     0  1  
     1  4  
    ╰───┴───╯ 
 1  ╭───┬───╮ 
     0  2  
     1  5  
    ╰───┴───╯ 
 2  ╭───┬───╮ 
     0  3  
     1  6  
    ╰───┴───╯ 
╰───┴───────────╯

Rename .ogg files to match an existing list of filenames

> glob *.ogg | zip ['bang.ogg', 'fanfare.ogg', 'laser.ogg'] | each {|| mv $in.0 $in.1 }