What is Nostr?
andrew / Andrew
npub1kun…p0ge
2023-01-09 07:52:11

andrew on Nostr: The implementation is entirely in jq and is 10 lines of code 🤯 ...

The implementation is entirely in jq and is 10 lines of code 🤯

https://github.com/stedolan/jq/blob/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8/src/builtin.jq#L282-L293

# SQL-ish operators here:
def INDEX(stream; idx_expr):
reduce stream as $row ({}; .[$row|idx_expr|tostring] = $row);
def INDEX(idx_expr): INDEX(.[]; idx_expr);
def JOIN($idx; idx_expr):
[.[] | [., $idx[idx_expr]]];
def JOIN($idx; stream; idx_expr):
stream | [., $idx[idx_expr]];
def JOIN($idx; stream; idx_expr; join_expr):
stream | [., $idx[idx_expr]] | join_expr;
def IN(s): any(s == .; .);
def IN(src; s): any(src == s; .);
Author Public Key
npub1kundug94z4c9llhf29v3ar657she8wu9p80cr2z3e4dujj0vzveqwpp0ge