819 karma · joined April 6, 2020
Results can be emitted iteratively using generators, which are implemented as tail-recursive streams [0]. Combined with the `input` built-in filter, which yields the next item in the input stream, and jq can handle real-time I/O and function as a more general-purpose programming language.
I built an interpreter for the Whitespace programming language in jq using these concepts and it's easily one of the most complex jq programs out there.
[0]: https://stedolan.github.io/jq/manual/#Generatorsanditerators
With a relatively large jq program like that, it is critical that the main recursive loop run efficiently, so it's annoying that there's no way to detect whether tail call optimization was applied, other than benchmarking. It would also be nice if object values were lazily evaluated so that it would be possible to create ad hoc switches.
! Hide low-quality results on DuckDuckGo
duckduckgo.com##[data-domain="w3schools.com"]
duckduckgo.com##[data-domain$=".w3schools.com"]
duckduckgo.com##[data-domain="w3schools.in"]
duckduckgo.com##[data-domain$=".w3schools.in"]
duckduckgo.com##[data-domain="download.cnet.com"]
!! Stack Exchange mirrors
duckduckgo.com##[data-domain="exceptionshub.com"]
duckduckgo.com##[data-domain="intellipaat.com"]Here is my favorite, Capsized by Zak Kain for Stanford's Code Poetry Slam:
.ocean {
color: cornflowerblue;
pitch: high;
overflow: visible;
}
.boat {
color: firebrick;
transform: rotate(94deg);
float: none;
}
.rescue-team {
visibility: visible;
}
.crew {
widows: none;
}
https://web.archive.org/web/20170522035639/http://stanford.e...