Questions tagged [expression]

Combination of several programming symbols and values intending to produce a result

An expression is code before it gets evaluated. That is, evaluating an expression will give you a result.

Expressions can consists of combinations of variables, constants, operators, function calls, or whatever constructs are available in that language.

Many s have an expression data type, and an evaluation function (often called eval), where calling eval(an_expression) will calculate a result.

Related tags

7598 questions
2
votes
2 answers

Parse comma-separated text between parentheses as array of key-value pairs

I am trying to parse 1 line that is constructed in this format: Files("textfile1.txt", 7268474425, "textfile2.txt", 661204928, "textfile3.txt", 121034) I have this working perfectly in C# using named capture groups, but this is PHP and strictly on…
Jonny
  • 73
  • 7
2
votes
1 answer

Getting the actual field data from a Linq Expression

I'm working on an ASP.NET MVC3 application and I annotated my model with an attribute that specifies what roles can change specific fields for any possible status the model is in. Take this as an example: public class Model { [RoleLimiter( …
Blindy
  • 65,249
  • 10
  • 91
  • 131
2
votes
1 answer

Can not use jsonpath expression in Postman

I have Json like this, and i tried to print a value i wanted by using JSonpath expression, detail is i wanted to print first_name of user has id = 10 { "page": 2, "per_page": 6, "total": 12, "total_pages": 2, "data": [ { …
2
votes
1 answer

Memory-wise, is it better to save a formula as a string or an expression (symbol), in Julia

I deal with lots of mathematical expressions in a certain Julia script and would like to know if storing such a formula as a String is ok, or whether using the Symbol data type is better. Thinking about scalability and keeping memory requirements to…
Zack
  • 181
  • 1
  • 11
2
votes
1 answer

LINQ to Entities Sort Expression based on client input

How can I dynamically sort an Entity Framework query based on a value provided by client? I have 2 user inputs: one that is value to filter the project by and the other is the way to order the results - either by date, state, priority or type. The…
gds03
  • 1,349
  • 3
  • 18
  • 39
2
votes
0 answers

C# Linq Expression has wrong DateTime format after generating sql

I have a generic class where I need to convert constructor parameters into DateTime?: var startDate = CompareValueFirst == null ? (DateTime?)null : Convert.ToDateTime(CompareValueFirst); var endDate = CompareValueSecond == null ? (DateTime?)null :…
2
votes
1 answer

R: Programmatically changing ggplot scale labels to Greek letters with expressions

I am trying to change the labels in a ggplot object to Greek symbols for an arbitrary number of labels. Thanks to this post, I can do this manually when I know the number of labels in advance and the number is not too large: # Simulate data …
socialscientist
  • 3,759
  • 5
  • 23
  • 58
2
votes
0 answers

What is the precision of arithmetic and comparison expressions in MySQL?

Reading the documentation. In the comparison expressions it says: If both arguments are integers, they are compared as integers. ... If one of the arguments is a decimal value, comparison depends on the other argument. The arguments are compared…
Grizzly
  • 371
  • 2
  • 13
2
votes
1 answer

Return Expression Check Condition in C++

Still getting used to the formatting when writing C++ code, come from a Lua background. How do I correctly format a if/conditional expressions as my example highlights below. This will correctly run, but with warnings which is unideal: return…
Theo
  • 45
  • 8
2
votes
2 answers

Expand expression in Spark Scala aggregation

I'm trying to convert a simple aggregation code from PySpark to Scala. The dataframes: # PySpark from pyspark.sql import functions as F df = spark.createDataFrame( [([10, 100],), ([20, 200],)], ['vals']) // Scala val df = Seq( …
ZygD
  • 22,092
  • 39
  • 79
  • 102
2
votes
3 answers

How does "local function myFunc()" works in lua?

All I learned about programming I learned by following youtube tutorials, or google, and some courses in edX, udemy. As far I understood variables are used for store values, string, etc, so i'm confused, to declare a local variable in lua, the…
2
votes
1 answer

combine expression objects into a single text string for ggplot labels

I am trying to create labels in ggplot that are comprised of character vectors and expressions combined into a single label. I want the characters and expressions to be sourced from objects so that I can easily use a function to swap them for…
wayne r
  • 110
  • 1
  • 5
2
votes
1 answer

Linq Expressions does not find a public method... :-/

I write a expression that will test if a property(enum) of a object have, or have not some flags set. The code bellow test if the validity of an object "contains" or not Monday, using the HasFlag function of an Enum. Actually, the Call method seems…
serhio
  • 28,010
  • 62
  • 221
  • 374
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
1 answer

Compound Statement Expression In C

Below code is not working. int i = {(void) 999; 100;}; Adding parentheses will work. WHY? int i = ({(void) 999; 100;}); There is another way to do this type of assignment: int i = ((void) 999, 100); What make them different?
Aison
  • 33
  • 3