Questions tagged [existential-operator]

9 questions
30
votes
3 answers

How do I use the CoffeeScript existential operator to check some object properties for undefined?

I would like to use the CoffeeScript existential operator to check some object properties for undefined. However, I encountered a little problem. Code like this: console.log test if test? Compiles to: if (typeof test !== "undefined" && test !==…
Przemek
  • 6,300
  • 12
  • 44
  • 61
12
votes
0 answers

coffeescript not null or undefined behavior

so i'm playing around with coffee-script and got this behavior: a? will translate to typeof a !== "undefined" && a !== null; - that's fine the problem is if i try the same for a.foo?. this time it translate to a.foo != null; the same result i get…
Sagiv Ofek
  • 25,190
  • 8
  • 60
  • 55
8
votes
1 answer

Existential quantification in Prolog facts

I am doing my first steps in Prolog (swi-prolog) and cannot solve the following problem: How can I include existentially quantified rules to my facts; specifically, how can I include the sentence "Everybody is a friend of somebody" \forall x \exists…
huxley
  • 83
  • 4
5
votes
2 answers

Existential operator in JavaScript?

I have a large json object. I need to access x = a.b.c.d.e.f.g. However b (or c, d, e...) can be undefined. This data structure is being imported from somewhere else. Is there a way to try to get to assign x with null or undefined without…
Alexis
  • 23,545
  • 19
  • 104
  • 143
5
votes
1 answer

How does CoffeeScript's existential operator work?

Coffeescript uses the existential operator to determine when a variable exists, and in the coffeescript documentation it shows that something? would compile to something !== undefined && something !== null however I noticed that my version of…
Loourr
  • 4,995
  • 10
  • 44
  • 68
4
votes
2 answers

Can prolog answer undetermined instead of just yes or no?

Suppose I have the knowledge base likes(john,mary). person(mary). person(john). If we ask prolog whether |?- likes(mary,john) It will answer no because we did not assert that. Is there any way to make prolog answer unknown unless we explicitly…
awiebe
  • 3,758
  • 4
  • 22
  • 33
2
votes
1 answer

Prolog: existentially quantifying

I am trying to understand the usage of existentially quantifying. What I know by now is this technique is used with setof, findall, bagof. Further, I found a tutorial. However, I am not sure when and how I do the Vars^Goal (existentially…
Woden
  • 1,054
  • 2
  • 13
  • 26
0
votes
2 answers

TSQL IN and NOT IN

I have the below query that returns all diagnosis that do not have a '-829' value associated to them. The query does work but I think that I've made it harder than it should be. Is there a tidier way of doing this? select distinct c2.diagnosisn…
Scotty
  • 45
  • 1
  • 7
-4
votes
2 answers

How can I know that I exist (Using Python)

How can I prove my existence using lines of code, is there a way an interaction between me and my CLI can provide me with assurance I exist, that everything around me is not a lie or unreal?
johan855
  • 1,578
  • 4
  • 26
  • 51