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
1
vote
6 answers

How do get input 2^3 to Math.pow(2, 3)?

I have this simple calculator script, but it doesn't allow power ^. function getValues() { var input = document.getElementById('value').value; document.getElementById('result').innerHTML = eval(input); }
user7504257
1
vote
0 answers

upgrade from struts 2.1 to struts 2.5 issues

We are upgrading Struts2 from 2.1 to 2.5, and we migrated all the code from the 2.1 version (which was perfectly working) to the 2.5 version. We have been resolving several little issues, but one in particular caught my attention. In the old…
Chiti Dahan
  • 244
  • 2
  • 14
1
vote
1 answer

Evaluate strings for regression

From these strings data = "mtcars" y = "mpg" x = c("cyl","disp") , I am trying to perform a linear model. I tried things like epp=function(x) eval(parse(text=paste0(x,collapse="+"))) lm(data=epp(data),epp(y)~epp(x)) # Error in eval(expr,…
Remi.b
  • 17,389
  • 28
  • 87
  • 168
1
vote
1 answer

Assigning to an environment in R

The code: env <- new.env() assign("X", value = 2, pos = env) eval(X, envir = env) Results in an error: "X not found" However: ls(envir = env) returns "X" Why doesn't the eval return 2?
andrewH
  • 2,281
  • 2
  • 22
  • 32
1
vote
0 answers

Check a condition statement stored in a string

Suppose I have a condition and its stated in NSSring like: NSString *someString = @"4%2 == 0"; Is there any way I could use it in a if statement as a condition? Just like if(extractConditionUsingSomeLogic(someString)){ NSLog(@"Yayyy"); }
Firdous
  • 4,624
  • 13
  • 41
  • 80
1
vote
0 answers

spring replace class ExpressionEvaluationUtils

I have the following code and I migrated my project from spring 3 to spring 4. But ExpressionEvaluationUtils is obsolete actually. Do you have any idea to replace it ? /** * Set quote escaping for this tag, as boolean value. Default is "true". …
Jerome Campeaux
  • 353
  • 2
  • 9
  • 19
1
vote
1 answer

Compare lists of functors and unify variables

How can I verify if two lists represent the same relationship between their variables in any given order and then unify the corresponding variables? For example the list: [#=(_G13544,_G13547+1),#=(_G13553,_G13554),#=(_G13559,2),#>(_G13559,…
fpg1503
  • 7,492
  • 6
  • 29
  • 49
1
vote
1 answer

Strange behavior in default argument enclos =parent.frame() of eval function

I'm currently having some issues understanding the behavior of the eval function- specifically the enclos/third argument when an argument isn't supplied to it/ the default argument parent.fame() is used. name <- function(x){ …
k13
  • 713
  • 8
  • 17
1
vote
2 answers

How to automatically evaluate expressions after hash rockets in Sublime Text

In the Ruby Kickstart tutorial ('05:10), when a hash rocket # => is typed within the text editor, it shows what the expression will evaluate to. For example: 2 + 3 # => 5 I am using Sublime Text 2, though cannot find how to get this to work.…
1
vote
1 answer

Evaluating code blocks in Rebol3

I'm trying to improve the Sliding Tile Puzzle example by making the starting positions random. There's a better way to do this--"It is considered bad practice to convert values to strings and join them together to pass to do for evaluation."--but…
Kev
  • 15,899
  • 15
  • 79
  • 112
1
vote
1 answer

Pattern evaluater

I have some a string which needed to be evaluated in following pattern - Input => String testTree = "(1(2(4)())(3))"; Output => {1,2,3,4,*,*,*} Input => String testTree2 = "(1(2(4)(5))(3()(4()(3))))"; Output =>…
1
vote
1 answer

Logical Evaluator

I have a program which needs to support "User Options" to determine how it will overwrite files, the user can choose from "Options" which can result into several combinations making it hard to code all the possible "IF... ELSE statements", this…
1
vote
3 answers

Design assistance: Calculation of time with expression parsed at runtime

I have some columns in the database which contain time inHH:MM format. Now if there are simple expressions like 11:00 - 12:00 then i can easily make an extension method in C# called as SubtractTime and pass my arguments at runtime. I will store my…
1
vote
2 answers

Evaluate args of a function call and convert the call to a character vector in R

I am trying to write a function which would take as argument a function call, evaluates numeric args of this function call and then return corresponding character vector. This is what I have came up with: ConvertToCharacter <-…
hestoo
  • 13
  • 3
1
vote
1 answer

JSP: Evaluate EL expression in SimpleTagSupport - getExpressionEvaluator deprecated? (Spring MVC)

I have a tag class that extends javax.servlet.jsp.tagext.SimpleTagSupport. I want to process its body BEFORE the Expression Language is evaluated, so I have: tagdependent in my .tld file. After doing my stuff with the…
Piotr Ma'niak
  • 698
  • 8
  • 17