Hacker News new | ask | show | jobs
by jbritton 931 days ago
The 2nd and 3rd examples make no sense to me.

echo '{"a": 1, "b": 2}' | jaq 'add'

3

Construct an array from an object in two ways and show that they are equal:

$ echo '{"a": 1, "b": 2}' | jaq '[.a, .b] == [.[]]'

true

1 comments

What might be confusing is that iterating an object iterates its values. add is defined something like this: def add: reduce .[] as $n (0; . + $n)