Skip to content

1.2

Compare
Choose a tag to compare
@github-actions github-actions released this 17 Nov 12:41
· 147 commits to main since this release

jaq is a jq clone with an emphasis on correctness, speed, and simplicity.

This release brings initial support for tail-recursion optimisation. For example, the filter

def repeat(f): def rec: f, rec; rec; repeat(1)

yielded a stack overflow after several values in jaq before. Now, jaq will actually yield an infinite stream of ones.

As a result, several filters have been rewritten to leverage tail-recursion optimisation, in particular repeat and paths. The filters recurse, while, and until, which previously had to be implemented as native filters, are now implemented by definition, which significantly simplifies the code base.

Furthermore, a few filters are now executed more lazily, including array construction ([...]) and reduce/foreach/for. For example, the filters

def f: 1, [f]; limit(1; f)

and

def f: f; limit(1; foreach (0, f) as $x (1; .))

yielded a stack overflow in jaq before. Now, both just return 1, like jq.

Finally, as cherry on the icing, jaq now implements the range/3 filter and range/2 supports more maximal elements. For example, range(1; 10; 2) yields 1, 3, 5, 7, 9, and range(0; infinite) now yields the (infinite) stream of all natural numbers.

Full Changelog: v1.1.2...v1.2.0