"Any" means "at least one". Use this tag for questions that deal with testing elements in a collection to see if at least one of them passes a condition.
Questions tagged [any]
682 questions
7
votes
4 answers
Why do some Scala methods use polymorphic arguments instead of using Any/Nothing?
For example, Exception.allCatch is defined as
def allCatch[T]: Catch[T]
Why not just
val allCatch: Catch[Nothing]
when Catch is covariant in its argument?
Or, why PartialFunction object defines
def empty[A, B]: PartialFunction[A, B]
instead of…

Petr
- 62,528
- 13
- 153
- 317
7
votes
1 answer
What does Any() mean in this LINQ query?
What is the Any() doing in the following query?
context.Customers
.Include("InternetSales")
.Where(c => c.InternetSales.Any())
.Take(100);
How would you read out this query in plain English? For example, would the following be…

NoChance
- 5,632
- 4
- 31
- 45
6
votes
2 answers
How do I obtain the value that caused any() to return True?
When I call the any() function, it returns only True or False. If it returns True, how can I obtain the element that caused it to return True?
all = ['azeri', 'english', 'japan', 'india', 'indonesia']
lg = 'from japan'
lgn = lg.split()
if any(word…

Armand Dwi
- 137
- 5
6
votes
1 answer
Difference between CREATE TABLE and CREATE ANY TABLE privileges
I don't understand the difference between these two privileges.
I found these two explanations but it's not helping me.
CREATE TABLE -> Enables a user to create a table owned by that user.
CREATE ANY TABLE -> Enables a user to create a table owned…

AwesomeGuy
- 537
- 1
- 6
- 17
6
votes
2 answers
How to block implicitly casting from `any` to a stronger type
TypeScript allows implicitly casting from any to a stronger type. Considering deserialized JSON is of type any, this behavior allows many type errors and breaks typings.
What compiler or linting options can I use to block implicitly casting from…

twinlakes
- 9,438
- 6
- 31
- 42
6
votes
2 answers
Applying "or" function to more than two vectors Matlab
I wish to include or (or any) within a function where the number of arguments (logical vectors) passed in can be more than two and can vary in number.
For example, the parent function may create
a=[1;0;0;0]
b=[0;1;0;0]
c=[0;0;0;1]
but the next…

Mary
- 788
- 6
- 19
- 43
6
votes
3 answers
postgresql search text into array of text
i have a table t1
id | names
----|-------------------------
1 | {jully , alex , sarah}
2 | {bety , cate , jenifer}
3 | {adam , pit , joee}
4 | {piter , mat , andy}
so, i need rows have at least one name that start with "a"
the result…

Mehdi Monzavi
- 117
- 2
- 8
6
votes
1 answer
Convenient 'Option>' access when success is assured?
When writing callbacks for generic interfaces, it can be useful for them to define their own local data which they are responsible for creating and accessing.
In C I would just use a void pointer, C-like example:
struct SomeTool {
int type;
…

ideasman42
- 42,413
- 44
- 197
- 320
6
votes
1 answer
jq select attribute if any array element satisfies a condition
With the help of jq i would like to select all addresses of nodes that have at least one required=true in their attribute list. The result list should have unique items.
Here is my Json:
{
"nodes": [
{
"address":"127.0.0.1",
…

Peter Lutz
- 165
- 5
- 9
6
votes
3 answers
how to use python's any
I feel very confused about some code like this[not written by me]:
version = any(func1(), func2()) # wrong, should be any([func1(), func2()])
def func1():
if something:
return 1
else:
return None
def func2():
if something:
…

chyoo CHENG
- 720
- 2
- 9
- 22
6
votes
2 answers
How can I do bi-directional mapping over @Any annotated property?
In this article http://www.jroller.com/eyallupu/entry/hibernate_the_any_annotation and also in this question How to use Hibernate @Any-related annotations?, how @Any annotation can be used was explained. But how can I get borrows for each…

TanerDiler
- 187
- 2
- 8
5
votes
2 answers
Python NameError: global name 'any' is not defined
I am getting the following error on my production server:
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", line 89, in get_response
response = middleware_method(request)
File…

Darwin Tech
- 18,449
- 38
- 112
- 187
5
votes
2 answers
AnyIterator and boost iterator facade
Is it possible to implement an any iterator with boost iterator facade?
I don't want to define implementation details in my baseclass
class Base
{
public:
typedef std::vector::iterator iterator;//implementation detail
...
virtual iterator…

P3trus
- 51
- 1
- 2
5
votes
4 answers
Combine an IF LET with an OR in Swift
Is there a graceful way to combine two if let statements by an or operator. For instance, I need to check for the strings "pass", "true", or the integer 1. The following function, does just that...
func test(content: Any) -> String {
if let…

Caleb Rudnicki
- 345
- 8
- 17