Assume input is an array you can do it several ways depending on what you want:
# output each value in the array separately
.[]
# output each value but transform it in some way
.[] | . * 2
# map each value into a new array
map(. * 2)
# same as above but manual iterate/collect
[.[] | . * 2]
The jaq author is working on a formal specification of jq https://github.com/01mf02/jq-lang-spec. I think it has also help that there are several implementations of jq now like, gojq, jaq and jqjq, that has helped finding edge cases and weird behaviours.
Yeap the syntax and semantics is quite different to other languages and it really took me a long time and deep understanding to really appreciate how expressive and damn well designed it is.
Great documentary, New York collector (Kim) gifts huge video library to an Italian town. When a former Kim's customer hunts it down, he finds water-damaged tapes in a disused store-room - and mafia overtones standing in his way!
reply