Skip to content

Commit

Permalink
improve performance of isempty by self-contained definition
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Feb 26, 2022
1 parent 5189c10 commit 1cc46e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion builtin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion builtin.jq
Expand Up @@ -109,7 +109,7 @@ def first: .[0];
def first(g): label $out | g | ., break $out;
def last: .[-1];
def last(g): reduce g as $item (null; $item);
def isempty(g): first((g|false), true);
def isempty(g): label $out | (g | false, break $out), true;
def all: all(.[]; .);
def all(y): all(.[]; y);
def all(g; y): isempty(g|y and empty);
Expand Down

0 comments on commit 1cc46e4

Please sign in to comment.