Questions tagged [negation]

Negation is the logic operation that inverses a value, also seen as a NOT operation. Functions in specific languages may operate with negation to specific uses. For questions specific to the use of complement patterns in regular expressions, use [regex-negation] instead.

Negation is the logic operation that inverses a value, also seen as a NOT operation. Negation may be implemented by specific languages to provide functions capable of operating with values for specific uses.

Read also the wikipedia article on Negation.

248 questions
0
votes
0 answers

Prolog if then with negated condition

I have a complex program, a part of which looks somewhat like this: check_list([]). check_list([X|List]) :- (try_something(X) -> write(1);write(0)),nl,check_list(List). The problem is that, when my list gets very large, Prolog gives me "Resource…
SandraS
  • 41
  • 3
0
votes
0 answers

How to add a negation operator to the consequent in propositional Prolog

I am wondering if perhaps someone would be willing to help me with a problem that I am having with some code that I have written in propositional Prolog. The program is as follows: :- dynamic…
0
votes
1 answer

What is the equivalent of logical negation/not operator

I've to execute a piece of code written in Visual Basic for Applications (VBA) when the excel cell is not empty. I've written below piece of code so far: Public Sub BindTitles(ByVal cell As Range) If IsEmpty(cell.Value) Then …
RBT
  • 24,161
  • 21
  • 159
  • 240
0
votes
2 answers

How to negate an entire expression using EL

Similar to Java, I need to negate an entire expression in JSP using EL. For eg in JAVA: if(!((a.equals("coding")) && (b.equals("forever")))){ //do this } what is the equivalent statment in EL for this ? I tried the below line but it throwed…
RRN
  • 61
  • 1
  • 5
  • 13
0
votes
1 answer

In python is "key not in container" allowed, or must we write "not (key in container)?"

In python, I know that it is permissible to write: happy_bag = list() if not (key in happy_bag): print(key, " ain't in da bag.") But would it also be okay to write: happy_bag = list() if key not in happy_bag: print(key, " ain't in da…
Toothpick Anemone
  • 4,290
  • 2
  • 20
  • 42
0
votes
1 answer

Clojure, Enlive: how to use negation when using multi-step for selector?

I'm using Enlive for Clojure. I'm trying to get span tags with class "title" within li tags, within a specific div tag.
  • wanted
  • wanted
  • gini09
    • 259
    • 3
    • 13
    0
    votes
    2 answers

    How to negate all children in CSS?

    I need to select all
    s on the page, except for all children of a div with an id of do-not-select. My current selector is: div:not(#do-not-select *) However, it does not work because the :not operator does not allow complex selectors.…
    Victor2748
    • 4,149
    • 13
    • 52
    • 89
    0
    votes
    1 answer

    How to make sure a user is entering a specific string?

    I'm trying to ask a user whether they want to encrypt or decrypt a message, and I know that I need to use userInput.equals("encrypt"), but i want to use a while loop with !=. while(userInput.!equals("encrypt") || userInput.!equals("decrypt")){ …
    user7380832
    0
    votes
    1 answer

    CSS element negation for Chrome Stylish (common icons)

    I use the Stylish extension in Chrome and a custom CSS to force one, big font on all web pages for all elements, because fonts on many pages are too artsy for my eyesight. * { font-family: "Arial" !important; font-weight: bold !important; …
    MrSparkly
    • 627
    • 1
    • 7
    • 17
    0
    votes
    1 answer

    Print negated words that follows "no,not,never" in a sentence in Python

    How do I print all negated word that follows "no","not", "never" so on. The sentence is SENTENCE="It was never going to work.I'm not happy" Desired output going,happy (Which follows never and not) Any help !
    Chathuri Fernando
    • 950
    • 3
    • 11
    • 22
    0
    votes
    1 answer

    iptables negation: which parts does it affect?

    When I use negation in iptables, does it affect only the parameter after the "!", or does it also affect everything after it? For example, if I wants to allow only ip address 1.2.3.4 to perform only ssh and nothing else, I use iptables -I INPUT ! -s…
    lisprogtor
    • 5,677
    • 11
    • 17
    0
    votes
    2 answers

    How does the negation !my_function() effect my function in C?

    This is my read_double function. Why do I have to check for !flush_buff() or what is its effect? I somehow cannot figure it out. Couldn't I just write flush_buff() and then return DBL_MIN? double read_double(void) { double x; int c,…
    J. Wu
    • 69
    • 1
    • 1
    • 7
    0
    votes
    2 answers

    R: gsub only if negation occurs within n letters before the target

    I am working on a primitive speech analysis algorithm. Now I want to improve how it handles negations of positive/negative statements. At the moment I add the string "NOT_" only if the negation directly occurs: s_commentsOut$gsubContent <- gsub("not…
    florian
    • 604
    • 8
    • 31
    0
    votes
    1 answer

    Find all where hstore does not contain any specified keys

    In the hstore docs there is a documented operator to check if the hstore contains all specified keys: Operator: hstore ?& text[] Description: does hstore contain all specified keys? Example: 'a=>1,b=>2'::hstore ?& ARRAY['a','b'] Result: => t My…
    davegson
    • 8,205
    • 4
    • 51
    • 71
    0
    votes
    1 answer

    negating multiple conditions as whole or individually in a While loop

    I am trying to understand why the below code does not work even though a variation of it works. My understanding eventually both mean the same thing.(I am pretty sure I am wrong, but don't know why) this works while (!(luc === 'rock' || luc ===…
    Taha Sk
    • 67
    • 1
    • 7