Giter VIP home page Giter VIP logo

Comments (5)

01mf02 avatar 01mf02 commented on September 18, 2024

Okay, I can see that INDEX works, but I have no intent of adding SQL-style operators, as written in the README.

Regarding combinations, how did you make these compile in jaq? combinations is defined recursively, so that yields the following error for me:

Error: could not find function
   ╭─[<unknown>:4:22]
   │
 4 │           | (.[1:] | combinations) as $y
   ·                      ──────┬─────  
   ·                            ╰─────── could not find function
───╯

from jaq.

pkoppstein avatar pkoppstein commented on September 18, 2024

@01mf02 - My apologies for erroneously including combinations. I've added some others that I have tested.

from jaq.

01mf02 avatar 01mf02 commented on September 18, 2024

Ok, I have now included normals and finites in 0537323. Thanks for your suggestion!

Thanks also for finding that bsearch compiles correctly; however, because the parser takes too long for my taste to parse such large expressions (~56 seconds on my machine for bsearch, see also #7), I would like to postpone integrating such filters until the parser is faster.

The other filters (IN, INDEX) are SQL-style operators which, as I have already mentioned, I do not wish to include in the standard library (because I do not like some filters to be uppercase, others lowercase etc.).
However, I could imagine something like an sql.jq module for SQL-style operators in the long run; but then, this would not be usable right now because jaq does not support modules.

from jaq.

01mf02 avatar 01mf02 commented on September 18, 2024

Just for reference, I have just sped up the parser in 012c9c5, so filters like bsearch should be feasible to implement now.
However, I am more inclined to keep the standard library small, so I do not like to include a filter like bsearch in it.

from jaq.

pkoppstein avatar pkoppstein commented on September 18, 2024

@01mf02 - Thanks for your careful and considerate explanations. I'm glad you were able to speed up the parser.

Since both IN/1 and INDEX/2 in particular are actually quite important, apart from being useful and widely used, I would like to make a plea on their behalf.

Both are useful and widely used because they are stream-oriented, and in particular because of the efficiency that stream-orientation makes possible. It seems to me that they're also important because they provide convenient access to the stream-oriented foundations of jq. Having standardized definitions of such basic functionality is also very useful. In this regard, I'd like to mention that gojq also supports them.

By the way, neither IN nor INDEX is "SQLish" in any meaningful way, at least that I'm aware of. The choice of uppercase names was evidently largely the result of some poor planning --in and index had already been documented. If you are absolutely opposed to including filters with uppercase names, then I hope you would consider including them but with names to your liking.

The case for bsearch is certainly less compelling, and the jaq-based implementation even more so, but having a simple-to-use and standardized binary search function readily available is often really helpful.

For these reasons, as well as for compatibility with both jq and gojq, I would ask that you reconsider their inclusion.

(If the implementation of bsearch in jaq turns out to be unsatisfactory, it could always be replaced by one written in Rust :-)

Thanks!

from jaq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.