Questions tagged [evaluation]

Anything related to evaluation of expressions, i.e. the process used to determine the value of expressions in a running program.

What is it?

Evaluation is about rules, algorithms and strategies used for the evaluation of expressions or the computation of evaluation functions.

Related tags

  • The tag may be used more specifically for the execution or invocation of evaluations.
  • For more specific questions use tags such as for example

See also:

1334 questions
323
votes
10 answers

How does a ArrayList's contains() method evaluate objects?

Say I create one object and add it to my ArrayList. If I then create another object with exactly the same constructor input, will the contains() method evaluate the two objects to be the same? Assume the constructor doesn't do anything funny with…
Mantas Vidutis
  • 16,376
  • 20
  • 76
  • 92
95
votes
8 answers

Turn string into operator

How can I turn a string such as "+" into the operator plus?
hwong557
  • 1,309
  • 1
  • 10
  • 15
90
votes
8 answers

What is the purpose of the unary plus (+) operator in C?

In C, it's legal to write something like: int foo = +4; However, as far as I can tell, the unary plus (+) in +4 is a no-op. Is it?
zneak
  • 134,922
  • 42
  • 253
  • 328
86
votes
11 answers

Having to set objectives for developers, even though objectives don't work

It is generally accepted that setting measurable objectives for software developers doesn't work , as too much focus on the objectives can lead to behaviour counter to the organisational goals (so-called "measurement dysfunction"). However, in my…
Paul Stephenson
  • 67,682
  • 9
  • 49
  • 51
81
votes
6 answers

What's the explanation for Exercise 1.6 in SICP?

I'm just beginning to work through SICP (on my own; this isn't for a class), and I've been struggling with Exercise 1.6 for a couple of days and I just can't seem to figure it out. This is the one where Alyssa re-defines if in terms of cond, like…
Alex Basson
  • 10,967
  • 6
  • 29
  • 44
78
votes
2 answers

Evaluation & Calculate Top-N Accuracy: Top 1 and Top 5

I have come across few (Machine learning-classification problem) journal papers mentioned about evaluate accuracy with Top-N approach. Data was show that Top 1 accuracy = 42.5%, and Top-5 accuracy = 72.5% in the same training, testing condition. I…
D_9268
  • 1,039
  • 2
  • 9
  • 17
76
votes
7 answers

Parameter evaluation order before a function calling in C

Can it be assumed a evaluation order of the function parameters when calling it in C ? According to the following program, it seems that there is not a particular order when I executed it. #include int main() { int a[] = {1, 2, 3}; …
corto
  • 2,657
  • 4
  • 21
  • 9
71
votes
6 answers

In Java, what are the boolean "order of operations"?

Let's take a simple example of an object Cat. I want to be sure the "not null" cat is either orange or grey. if(cat != null && cat.getColor() == "orange" || cat.getColor() == "grey") { //do stuff } I believe AND comes first, then the OR. I'm…
Stephano
  • 5,716
  • 7
  • 41
  • 57
62
votes
2 answers

What is the difference between quote and list?

I know that you can use ' (aka quote) to create a list, and I use this all the time, like this: > (car '(1 2 3)) 1 But it doesn’t always work like I’d expect. For example, I tried to create a list of functions, like this, but it didn’t work: >…
Alexis King
  • 43,109
  • 15
  • 131
  • 205
58
votes
7 answers

Is ++x %= 10 well-defined in C++?

While browsing the code of some project I came across the following statement: ++x %= 10; Is this statement well defined in C++ or does it fall into the same category as a[i] = i++ ?
kyku
  • 5,892
  • 4
  • 43
  • 51
53
votes
9 answers

Bash: evaluate a mathematical term?

echo 3+3 How can I evaluate such expressions in Bash, in this case to 6?
hhh
  • 50,788
  • 62
  • 179
  • 282
51
votes
2 answers

Difference between i++ and (i)++ in C

int i = 3; int j = (i)++; vs int i = 3; int j = i ++; Is there a difference between how the above two cases are evaluated? Is the first case equivalent to incrementing an rvalue or is it undefined behaviour?
Polaris000
  • 938
  • 1
  • 11
  • 24
46
votes
3 answers

SQL UPDATE order of evaluation

What is the order of evaluation in the following query: UPDATE tbl SET q = q + 1, p = q; That is, will "tbl"."p" be set to q or q + 1? Is order of evaluation here governed by SQL standard? Thanks. UPDATE After considering Migs' answer, I ran some…
pilcrow
  • 56,591
  • 13
  • 94
  • 135
44
votes
6 answers

What's the difference between XOR and NOT-EQUAL-TO?

My question uses Java as an example, but I guess it applies to probably all. Is there any practical difference between the XOR operator (^ in Java) and the not-equal-to operator (!= in Java), when comparing booleans? I evaluated things here, but I…
davidcesarino
  • 16,160
  • 16
  • 68
  • 109
43
votes
2 answers

Setting extra bits in a bool makes it true and false at the same time

If I get a bool variable and set its second bit to 1, then variable evaluates to true and false at the same time. Compile the following code with gcc6.3 with -g option, (gcc-v6.3.0/Linux/RHEL6.0-2016-x86_64/bin/g++ -g main.cpp -o mytest_d) and run…
BY408
  • 423
  • 4
  • 6
1
2 3
88 89