Skip to content

Proposal: extended static value sugar for filter #902

Closed

Description

@jdoliner

We have a really nice shorthand notation for doing filter which a lot of people have found very useful.

table.filter({"a" : 1, "b", 2})
#desugars to
table.filter(lambda x: x["a"] == 1 & x["b"] == 2) 

This is a proposal to extend this notation to make it even more useful.

Proposal

We extend the static sugar in filter to accept single argument functions as the values in the static value sugar in filter. This would allow you to do queries like this:

table.filter({"a" : r.match("\d*")}) # check if an attribute matches a regex
table.filter({"a" : r.gt(5)}) # check if an attribute is greater than 5

This seems like it would require a bit of jiggering in the client libraries but I think it's doable.

Activity

  1. coffeemug commented on May 24, 2013

    @coffeemug
    Contributor

    👍 (but let's keep this discussion dormant until we slate this proposal for a sprint)

  2. linuxdynasty commented on May 25, 2013

    @linuxdynasty

    I would definitely find the above extremely useful..

  3. jdoliner commented on Jul 19, 2013

    @jdoliner
    ContributorAuthor

    Subsumed by #1190.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions