In accordance with our meta agreement, since one candidate received more votes than the others, we have a new featured language! Throughout September 2021, our Language of the Month will be:
jq
What's a Language of the Month?
See the meta post for nominations. In short, during September, those who wish to participate should learn jq, and use it to solve challenges.
Information about jq
jq is a lightweight practical language for querying JSON files. It's like sed for JSON files.
- Streams in jq can be very powerful. Operators see individual items in strings when applied:
range(4) -> 0, 1, 2, 3
range(4) + 2 -> 1, 2, 3, 4
# Sometimes, a cartesian-product-like output can be produced with
range(2) + range(4) -> 0,1, 1,2, 2,3, 3,4
- Piping - Outputs of the previous expression can be piped.
3 | .+2 # -> 5
[3, 4, 5] | max # -> 5
- Compact syntax
[1, 2, 3] | map( . + 1 ) # -> [2, 3, 4]
# (This could also be achieved as [1, 2, 3][]|.+1)
Bounty
I (Emanresu A, or whatever I end up changing my name to) will award a +50 bounty for any user's first jq answer posted during this month. A user doesn't qualify if they have posted a jq answer before.
I will only award this bounty on questions which I haven't answered, because I have to award +100 or more on questions which I have. If the question you answered has been answered by me as well, provide another jq answer and I'll happily bounty that.
1,2,3|.+1
! Try it online \$\endgroup\$range(4)+2
should be2,3,4,5
\$\endgroup\$