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
0
votes
2 answers

Macro to record evaluation steps and intermediate values in Racket?

As an exercise in learning the Racket macro system, I've been implementing a unit testing framework, based on the C++ catch framework. One of the features of that framework is that if I write a check like this: CHECK(x == y); // (check x y) When…
Joseph Garvin
  • 20,727
  • 18
  • 94
  • 165
0
votes
4 answers

sed replace number with number-1

Can sed handle a substitution and simultaneously evaluate an expression to substitute somehow? For example, I have the following entry in a text file: ##################################### topd Tree1 - Tree14…
Joe Healey
  • 1,232
  • 3
  • 15
  • 34
0
votes
1 answer

function to load multiple packages with input as non-character list

I got tired of starting my scripts with require(data.table); require(ggplot2) etc etc. I know that I could do something like lapply(c('data.table', 'ggplot2'), require, character.only=T), but it would just return a warning (not an error) for a…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
0
votes
2 answers

spring evaluate expression (SpEL), how can I force it to not interprete some specials characteres

I'm using spring tool SpEL to evaluate some expressions. The expression contain HTML/css programatically generated and some variables to evaluate. TOTAL HT   = totalItem where totalItem is a…
0
votes
1 answer

Changing order of expression evaluation on each function call in Haskell

Suppose I have a following program: foo x y = let l1 = foo 0 x l2 = foo 0 y in l1 + l2 This is just a simple example, but I think is enough for demonstration purposes. How could I, with each new (recursive) call to foo,…
0
votes
1 answer

Passing an evaluated expression as named arg to function within function (R)

I would like to expand a data.frame to include a new column & give this column a dynamically assigned name passed within a function. Here is a simplified example: passMyName <-function(df, newColTitle) { df2 <-data.frame(df, newColTitle = rep(NA,…
raco
  • 67
  • 5
0
votes
1 answer

What is the returned value of a compound expression in R?

In R, I can do: {1+1; 2+2; 3+3} or, if you prefer: {1+1 2+2 3+3} Perhaps not surprisingly, both of these (compound) expressions evaluate to 6. Is this a (documented) feature of the R language, that the value of a compound expression is equal to…
Al R.
  • 2,430
  • 4
  • 28
  • 40
0
votes
1 answer

Making evaluators with user-defined procedures

So I'm working with DrRacket and since I'm making a manual via #lang scribble for my procedures I'd like to put actual examples of my procedures running using @interactions So far I've got this part: #lang scribble/manual @(require (for-label…
David Merinos
  • 1,195
  • 1
  • 14
  • 36
0
votes
0 answers

NCalc using symbols in custom function name

Let's say that in my expression input I like to make functions stand out with a special prefix like $: var expr = "Your name is $proper([firstName]) $upper([lastName])"; where I would write custom functions for $proper and $upper. However, I get…
drzaus
  • 24,171
  • 16
  • 142
  • 201
0
votes
0 answers

How to avoid loading an assembly multiple times in C#?

I have an expression evaluator project in C# that generates IL and converts the IL into an evaluation methods. The issue is that, there is no way to unload an assembly from C# and the compiler keeps on adding the assemblies to the current app…
Steelbird
  • 49
  • 6
0
votes
1 answer

Odd behavior with doubles and oStringStream

so I am working on an expression evaluator as an internal component on a work related project. but I am having some weird behavior when it comes to the output of floating point math... the evaluator takes in a string e.evaluate("99989.3 +…
asuppa
  • 571
  • 1
  • 11
  • 27
0
votes
1 answer

Evaluate an expression and send the result to another program in Windows Batch

I don't know how can i make this clear in a short sentence, so i give this example Bash : ./foo $(ls -a) First, "ls -a" is evaluated and converts to its output. So we 've got this line ./foo some_script Downloads and then that's executed. How can…
nsmon93
  • 3
  • 3
0
votes
1 answer

Evaluating logarithm of expression, given logarithms of variables

I have to programmatically determine the value of the expression: S = log(x1y1 + x2y2 + x3y3 ...) Using only the values of: lxi = log(xi) lyi = log(yi) Calculating anti-logs of each of lxi and lyi would probably be impractical and is not desired…
0
votes
1 answer

Replace exponential values to double in mathematical expression

I need to check if a mathematical expression contains a exponential value and then replace the exponential value with decimal value. Input :"10993.657030812325*8.20681165367255E-05" Output :"10993.657030812325*0.0000820681165367255" The complexity I…
Rauld
  • 980
  • 2
  • 10
  • 19
0
votes
3 answers

why sometimes R can't tell difference between NA and 0?

I am trying to extract rows of data with field "var" equals 0. But I found "NA" were taken as 0: There are 20 rows of 0 and 809 rows of "NA". There are total 81291 rows in data frame d. > length(d$var[d$var == "0"]) [1] 829 > length(d$var[d$var…
user2783615
  • 829
  • 3
  • 11
  • 17