discussenhancementhelp wanted
説明
Currently, the in operator does the following for a in b example:
- if
bis a string, it checks ifais a substring ofb - if
bis a list, it checks ifais an element ofb
I propose that we extend the in operator to have the following additional behavior:
- if
bis a list, andais a list, thena in bshould check ifais a subset of the elements inb
Examples:
["a", "b"] in ["a", "b", "c"]== true["a", "d"] in ["a", "b", "c"]== false
The same goes for field references. Let's suppose the [tags] field is ["web", "frontend", "newyork", "staging"], then the following:
["web", "frontend"] in [tags]== true["db", "newyork"] in [tags]== false
General idea is to have in act as a subset check if both operands are list values (array literals, fieldreferences that have array values, etc)