Questions tagged [negate]
84 questions
8
votes
2 answers
Is there a reason why there is not std::identity in the standard library?
When dealing with generic code in C++, I would find a std::identity functor (like std::negate) very useful. Is there a particular reason why this is not present in the standard library?

Vincent
- 57,703
- 61
- 205
- 388
7
votes
3 answers
How to Negate a Context
I want to select elements, but not if one of their ancestor matches a certain selector.
For example, let's say I want to match all nodes that are not descendants of a table.
I tried something like this:
$("a", ":not(table *)");
but that crashes…

Aaron
- 3,249
- 4
- 35
- 51
7
votes
3 answers
How to negate bool inside function in JS?
I'm writing some script now and I have a problem when trying to negate boolean inside a function. I mean this:
var test = true;
function changeThisBoolPlease(asd){
asd=!asd;
}
alert(test);
changeThisBoolPlease(test);
alert(test);
alerts true,…

adam
- 395
- 1
- 2
- 14
5
votes
2 answers
Pyspark Function to Negate Column
Is there a built-in function to add a new column which is the negation of the original column?
Spark SQL has the function negative(). Pyspark does not seem to have inherited this function.
df_new = df.withColumn(negative("orginal"))

fermi
- 197
- 3
- 8
4
votes
3 answers
Ansible - negate Filter
I find some files with the find ansible module
- find:
paths: "/"
patterns: ["*.service"]
file_type: file
hidden: True
recurse: yes
register: find_results
when: ansible_service_mgr == "systemd"
Now I want to check modify the…

Stack Over
- 751
- 2
- 6
- 7
4
votes
2 answers
Understanding function composition with negate
After reading through a page on Higher Order Functions from an awesome site I am still having trouble understanding the negate function paired with function composition.
to be more specific, take this piece of code:
ghci> map (negate . sum . tail)…

Syntactic Fructose
- 18,936
- 23
- 91
- 177
4
votes
1 answer
negating self invoking function? !function ($) { ... }(window.jQuery);
Possible Duplicate:
What does the exclamation mark do before the function?
I was looking through the Twitter Bootstrap JavaScript code and I noticed all their plugins are wrapped in negating self invoking functions.
I am aware that function ($) {…

Hailwood
- 89,623
- 107
- 270
- 423
3
votes
1 answer
Perl regexp how to negate a part
I have to disjuncts
D= d1| d2|...|dn
and
F=f1|f2|...|fn
at the moment I check those two regexp with an if-statement looking like this:
if (($text_to_search =~ $D) && ($text_to_search !~ $F))
How can I negate F? Is it possible to use a negative…

Tyzak
- 2,430
- 8
- 38
- 52
3
votes
4 answers
How to apply not operator to all matrix elements in Julia?
I need to apply "not" operator to matrix of zeros and ones in Julia.
In Matlab I would do this:
A=not(B);
In Julia I tried doing this:
A = .~ B;
and
A = .! B;
It should turn zeros to ones and ones to zeros but I get error as a result or all…

Vasilije Bursac
- 185
- 1
- 2
- 15
3
votes
1 answer
Prolog - ASP 'not' to Prolog negate
I have an example problem in Answer Set Programming (ASP). When I try to make the equivalent code in Prolog, I keep getting stuck with the not blocked.
This is the ASP…

becky
- 33
- 4
3
votes
6 answers
int reverse sign negate( ) java
Requirements
Assume the availability of an existing class, ICalculator, that models an integer arithmetic calculator and contains:
an instance variable currentValue that stores the current int value
of the calculator and can be accessed and…

edmejia
- 93
- 1
- 4
- 15
2
votes
3 answers
Negate boost is_directory in std algorithm
boost::filesystem::recursive_directory_iterator end, begin(directory);
auto num_of_files=std::count_if(begin, end,
std::not1(boost::filesystem::is_directory)));
I am trying to negate the function is_directory on the above directory…

111111
- 15,686
- 6
- 47
- 62
2
votes
1 answer
How to negate boost::lambda:bind?
Let's say I have this type:
typedef boost::function filter_function;
And a vector of those "filter functions":
std::vector filters;
If want to call all the filter functions, one by one, and only the the last call…

ereOn
- 53,676
- 39
- 161
- 238
2
votes
0 answers
negate a javascript regex to match all except ranges
I'm not very good with regex and I could use some help.
I'm trying to match all characters except the ones defined by those ranges (ranges that match most emoji). How would I negate the statement below?
var nonEmoji = new…

Victor Dragnea
- 31
- 4
2
votes
1 answer
MySQL 5.x - Can you explain this weirdness?
Running the query ...
SELECT !(!0), ! !0, !!0 AS WTF;
in MySQL yields the following output ...
-------------------------
!(!0) | ! !0 | WTF
-------------------------
0 | 0 | 1 # <- What's going on here?
I can't seem to…

famagusta
- 67
- 6