logic Questions

9

Solved

My question is simple: "how to build a dynamic growing truth table in python in an elegant way?" for n=3 for p in False, True: for q in False, True: for r in False, True: print '|{0} | {1} | ...
Oriflamme asked 13/6, 2011 at 21:12

4

Solved

I want to implement the following logic with Mustache: {{#if users.length > 0}} <ul> {{#users}} <li>{{.}}</li> {{/users}} </ul> {{/if}} // eg. data = { users: ['To...
Tuberculosis asked 25/7, 2012 at 15:54

2

Solved

I'm fairly new to VBA, and I can't find an easy way to test if any of the specified variables equal a specified value. The below seems to work, but is there an easier way to do it? If variable1 = ...
Robledo asked 17/7, 2014 at 12:27

3

Solved

What's the difference between the following: a = np.array([2,3,4]) b = np.array([2,7,8]) if a.any() == b.all(): print('yes') and a = np.array([2,3,4]) b = np.array([2,7,8]) if a.any() == b.a...
Archdeacon asked 11/6, 2018 at 15:39

3

I have a boolean expression: equals(myStringValue, targetStringValue) I have an array expression which might or might not be valid, depending on the boolean condition myArrayExpression. I want to w...
Philharmonic asked 10/8, 2020 at 9:5

9

I have spent the last 5 hours searching for an answer. Even though I have found many answers they have not helped in any way. What I am basically looking for is a mathematical, arithmetic only rep...
Cirque asked 22/1, 2014 at 20:27

7

Solved

I've got some dynamically-generated boolean logic expressions, like: (A or B) and (C or D) A or (A and B) A empty - evaluates to True The placeholders get replaced with booleans. Should I, Co...
Pasturage asked 18/3, 2010 at 4:49

10

Solved

What is the simplest way to do a three-way exclusive OR? In other words, I have three values, and I want a statement that evaluates to true IFF only one of the three values is true. So far, this ...
Bracelet asked 12/8, 2010 at 9:49

2

Solved

I know that logical AND is &, and logical OR is | in a Pandas Series, but I was looking for an element-wise logical XOR. I could express it in terms of AND and OR, I suppose, but I'd prefer to ...
Blancheblanchette asked 26/8, 2015 at 22:33

5

Solved

I'll start of by saying that I understand that this topic is complicated and that there probably isn't an easy answer. If it were easy then everybody would be doing it. That being said... I've bee...

11

Solved

There's an array say [1,2,4,5,1]. I need to print all the contiguous sub-arrays from this. Input: [1,2,4,5,1] Output: 1 1,2 1,2,4 1,2,4,5 1,2,4,5,1 2 2,4 2,4,5 2,4,5,1 4 4,5 4,5,1 ...
Adaadabel asked 31/8, 2015 at 10:23

5

Solved

I am currently trying to learn some basic prolog. As I learn I want to stay away from if else statements to really understand the language. I am having trouble doing this though. I have a simple fu...
Typehigh asked 5/3, 2014 at 4:50

2

Solved

I want to create some nested conditions: i need this pipeline to work when it is a merge or merge request and with certain name start "feature". So, is there an AND condition in the 'only...
Atonsah asked 22/4, 2021 at 19:4

6

Solved

So I was writing a rock paper scissors game when I came to writing this function: a is player one's move, b is player two's move. All I need to figure out is if player one won, lost, or tied. //r...
Distillery asked 7/7, 2012 at 17:21

7

Solved

There seems to be some kind of misconception that this is for a contest. I'm trying to work through an assignment and I've been stuck on this for an hour now. /* * isLessOrEqual - if x <= y ...
Jobless asked 31/1, 2017 at 2:40

0

(This question is under a permanent bounty of 1000 points, once proven/refuted, it will be retrospectively set up and awarded) (Possible duplicate: https://math.stackexchange.com/questions/4232108/...
Zippel asked 31/1, 2023 at 1:12

3

Solved

In many Prolog guides the following code is used to illustrate "negation by failure" in Prolog. not(Goal) :- call(Goal), !, fail. not(Goal). However, those same tutorials and texts warn...
Spinster asked 3/12, 2022 at 0:13

9

Solved

I'm looking for some "inference rules" (similar to set operation rules or logic rules) which I can use to reduce a SQL query in complexity or size. Does there exist something like that? Any papers...
Yashmak asked 1/7, 2009 at 14:14

6

Solved

I want to implement a logical operation that works as efficient as possible. I need this truth table: p q p → q T T T T F F F T T F F T This, according to wikipedia is called "logical implicatio...
Milla asked 21/3, 2009 at 2:55

8

Solved

I came across an is_equals() function in a C API at work that returned 1 for non-equal SQL tables (false) and 0 for equal ones (true). I only realized it after running test cases on my code, one fo...
Underage asked 25/6, 2011 at 1:22

3

Solved

I want to select rows in which (a or b) == (c or d) without having to write out all the combinations. For example: a b c d 1 2 3 4 1 1 2 2 1 2 1 3 2 5 3 2 4 5 5 4 df$equal <- df$a == df$c | df$...
Recriminate asked 11/9, 2022 at 18:46

6

Solved

because power(base, exponent) has no return value unless exponent is 0, initially, shouldn't power(base, exponent -1) return 'undefined', and therefore be unmultipliable, initially? So, I am having...
Envoy asked 5/10, 2011 at 5:57

2

Solved

In Prolog we can write very simple programs like this: mammal(dog). mammal(cat). animal(X) :- mammal(X). The last line uses the symbol :- which informally lets us read the final fact as: if X is ...
Hintz asked 15/8, 2022 at 22:40

6

Solved

Is this a proper way to say: if something is the case, do nothing? if ( ($hostNameInfo == $hostNameInput) && ($hostAddressInfo == $hostAddressInput) ) { return; } Update: I'm not inside...
Guillen asked 3/9, 2010 at 9:12

10

Solved

I want to do something like if(something.val() == 'string1') { something.val('string2'); } else if(something.val() == 'string2') { something.val('string1') } But in one line of code. I can't q...
Cypripedium asked 27/9, 2010 at 20:49

© 2022 - 2024 — McMap. All rights reserved.