Questions tagged [negate]

81 questions
5
votes
2 answers

select columns that do NOT start with a string using dplyr in R

I want to select columns from my tibble that end with the letter R AND do NOT start with a character string ("hc"). For instance, if I have a dataframe that looks like this: name hc_1 hc_2 hc_3r hc_4r lw_1r lw_2 lw_3r lw_4 Joe 1 2 …
J.Sabree
  • 683
  • 6
  • 21
5
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
  • 365
  • 1
  • 2
  • 11
4
votes
2 answers

Convert positive value to negative value in swift

I want to convert a positive value to a negative value, for example: let a: Int = 10 turn it to -10, my current idea is just use it to multiple -1 a * -1 I'm not sure if this is proper, any idea?
William Hu
  • 12,918
  • 8
  • 85
  • 98
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
  • 15,445
  • 16
  • 74
  • 158
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
  • 79,753
  • 103
  • 257
  • 412
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,342
  • 7
  • 35
  • 50
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
  • 161
  • 1
  • 2
  • 10
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
  • 95
  • 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
  • 14,528
  • 6
  • 38
  • 58
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
  • 48,328
  • 33
  • 147
  • 228
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…
2
votes
1 answer

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
  • 168
  • 2
  • 6
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
2
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…
2
votes
2 answers

Suggestions on negating a regex expression/Lookaround search

Very new to regex and was hoping someone could help me with the syntax of negating a regex search. Let me elaborate. I want to look at a packet/information and trigger a positive alert if one (or more) of multiple criteria is not found. For…
joseph
  • 21
  • 2