Questions tagged [expression-evaluation]

Anything related to expression evaluation, i.e. the process of determining the value of an expression in running code.

Anything related to expression evaluation, i.e. the process of determining the value of an expression in running code.

189 questions
3
votes
2 answers

How does (constantly x) differ from (fn [& _] x)?

I'm using a multimethod to provide different functions depending on what "mode" my project is running in (it's a yada api server, and should be able to run in :dev, :prod modes etc). I'm using mount/defstate to provide a keyword: (defstate mode…
Jeremy Field
  • 652
  • 7
  • 12
3
votes
2 answers

What is the most efficient way to recalculate attributes of a Boost Spirit parse with a different symbol table?

I'm using Boost Spirit to implement functionality in some software that allows the user to enter a mathematical equation that will be repeatedly applied to an input stream. Input stream values are represented as symbols using…
Tim MB
  • 4,413
  • 4
  • 38
  • 48
3
votes
6 answers

How can I evaluate a math expression represented by a string?

It's easy to implement a "Calculator" to parse a string (e.g., 2 ^ 3 / 2) and compute the result of operations. But, is there a library already capable of doing this?
Luca
  • 11,646
  • 11
  • 70
  • 125
3
votes
1 answer

Is IronRuby ScriptSource.Execute thread safe?

We are implemented expression evaluator via hosting IronRuby engine. Simplified version of evaluator you can see here. Now we are trying to get more performance from IronRuby via executing expressions in many threads (and we got it). One question…
3
votes
1 answer

Efficient evaluation of spliced lists with a recurring argument

I want to recur through a list of slot names of classes, the same slot names for two classes ((current-trial *exp*) & (previous *exp*) refer to instances of the same class). On each recursion, I want to evaluate the slot name so that the value of…
fpt
  • 358
  • 3
  • 11
3
votes
2 answers

Boost::spirit how to parse and call c++ function-like expressions

I want to use boost spirit to parse an expression like function1(arg1, arg2, function2(arg1, arg2, arg3), function3(arg1,arg2)) and call corresponding c++ functions. What should be the grammar to parse above expression and call the…
kyy
  • 321
  • 3
  • 11
3
votes
1 answer

Starting to write a logical expression evaluator

I want to develop a logical expression evaluator to compute applicability of certain logical expression against a particular expression. For example, An expression could be of the form (A AND B) NOT C this expression should then be evaluated with…
3
votes
1 answer

How do I find and delete datatips throughout my solution in Visual Studio 2010?

I noticed that lots of expression evaluation popups datatips severely slow down going in and out of debugging, so I'd like to delete most of them (for that I need to find them first, is there a button for that?) or if it's not an option, delete all…
3
votes
0 answers

Janino ExpressionEvaluator not guessing all parameters?

Consider a simple use case for the ExpressionEvaluator class of the Janino library, i.e. when using it to guess the parameters of an expression, as follows: public static String[] getParameters(String expression) { // Suppress exceptions try { …
PNS
  • 19,295
  • 32
  • 96
  • 143
2
votes
4 answers

AND/OR chains in C

I'm pretty much positive about this, but just to be on the safe side: Does the C standard guarantee that AND chains (A && B && ...) will be evaluated left to right, and that evaluation will stop as soon as there's a 0? Same question for OR. (As soon…
Hammer
2
votes
1 answer

Order of function calls when creating an object of a class

[C++17] I have a class: class A { int a; int b; public: A(int a, int b) : a{ a }, b{ b } { } }; and two functions: int get_a() { return 1; } int get_b() { return 2; } Now I construct an object: A a{ get_a(), get_b() }; The question:…
Ragdoll Car
  • 141
  • 6
2
votes
5 answers

Building a boolean function from a string description

I have a large database of boolean values and want to build a framework for easily running queries over all of the values. To do this, I'd like to write a function that, given a string representation of a boolean expression, would evaluate that…
Nahum
  • 6,959
  • 12
  • 48
  • 69
2
votes
3 answers

c++, evaluating expressions with multiple `&&`s and no operator of lower precedence

If an expression evaluates multiple && operators, and does not evaluate any operators of lower precedence (eg. ||, ?:), will the expression evaluate to 0 as soon as one of the &&s return 0, or will it finish evaluating the remaining &&s? For…
2
votes
2 answers

Parsing querystring into dynamic sql (LINQ)

I don't visit nor ask things on here too much, so I hope this question is allowed. I've been assigned a task, to implement a REST service, where the GET endpoint would basically work as an OData service. But not exactly. I tried convincing the…
Wizaerd
  • 235
  • 3
  • 15
2
votes
3 answers

Expression evaluation in C

Why does the following piece of C code print 12 12 12 int main(int argc, char const *argv[]) { int a = 2, *f1, *f2; f1 = f2 = &a; *f2 += *f2 += a += 2.5; printf("%i %i %i\n", a, *f1, *f2); return 0; }
shreyasva
  • 13,126
  • 25
  • 78
  • 101