mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Add combinations/0 and combinations/1
This commit is contained in:
committed by
Nicolas Williams
parent
8aecf82bfe
commit
ec7647c4ab
@@ -1307,6 +1307,21 @@ sections:
|
||||
input: '["foobar", "barfoo"]'
|
||||
output: ['[false, true]']
|
||||
|
||||
- title: "`combinations`, `combinations(n)`"
|
||||
body: |
|
||||
|
||||
Outputs all combinations of the elements of the arrays in the
|
||||
input array. If given an argument `n`, it outputs all combinations
|
||||
of `n` repetitions of the input array.
|
||||
|
||||
examples:
|
||||
- program: 'combinations'
|
||||
input: '[[1,2], [3, 4]]'
|
||||
output: ['[1, 3]', '[1, 4]', '[2, 3]', '[2, 4]']
|
||||
- program: 'combinations(2)'
|
||||
input: '[0, 1]'
|
||||
output: ['[0, 0]', '[0, 1]', '[1, 0]', '[1, 1]']
|
||||
|
||||
- title: "`ltrimstr(str)`"
|
||||
body: |
|
||||
|
||||
|
Reference in New Issue
Block a user