Skip to main content

Questions tagged [expression-trees]

Expression Trees are an abstract representation of code in a tree structure where each node of the tree represents a programming construct (conditional, assignment, method call, etc.)

4 votes
2 answers
351 views

Designing a basic Binary Expression Tree structure

Preface I need to generate some algebraic expressions for math testing in elementary school. The test should generate a list of expressions compiled according to certain rules and check the ...
chptr-one's user avatar
  • 495
0 votes
1 answer
81 views

Deleter for Simple Expression Tree in C++

I have created a simple abstract class called expr_node which will serve as a base class for any expression-related nodes. My goal is to create a simple deleter ...
Desmond Gold's user avatar
4 votes
1 answer
7k views

A simple method to execute Entity Framework Core queries in parallel

As you might know, EF Core does not support executing multiple queries in parallel on the same context using something like Task.WhenAll. So you have to write this ...
wertzui's user avatar
  • 188
8 votes
2 answers
389 views

Immutable builder and updater

There aren't enough questions about creating immutable objects... so why not try it again with another approach. This time, it's a builder that maps properties to constructor parameters. Properties ...
t3chb0t's user avatar
  • 44.7k
3 votes
1 answer
529 views

Evaluate an expression binary tree - Daily Coding Challenge

Here is my solution for the Daily Coding Challenge 50 Given an arithmetic expression in the form of a binary tree, write a function to evaluate it Example ...
MrJoe's user avatar
  • 2,173
6 votes
3 answers
498 views

Simple object validator with a new API

Quite some time ago I have created the Simple object validator (see also self-answer). The more I used it the more I thougt its API could be better so I have heavily refactored it and would like to ...
t3chb0t's user avatar
  • 44.7k
2 votes
1 answer
122 views

Populating dropdown lists, using SQL vs. using expression trees and reflection

I'm working with a large enterprise SQL Server database with dozens of tables that are used mainly as lookups to populate dropdown lists, etc. These tables all follow the convention of having (table)...
Valuator's user avatar
  • 189
3 votes
0 answers
60 views

Configure multiple application features by common criteria

My FeatureSerivce provides only basic APIs, so it is good in dealing with single features. Like I can configure only one feauture at a time: ...
t3chb0t's user avatar
  • 44.7k
2 votes
2 answers
153 views

Creating keys/names from interfaces to avoid strings

There are many APIs that require some kind of a string key/name. I usually try to avoid using raw strings and prefer to use ...
t3chb0t's user avatar
  • 44.7k
7 votes
2 answers
499 views

Quiz for random boolean expressions

Inspired by the various quiz programs on this site, as well as Simon Tatham's puzzle collection, I thought I'd write a quiz that constructs its questions automatically and randomly. A typical session ...
Roland Illig's user avatar
  • 21.9k
5 votes
1 answer
2k views

Adjusting business logic conveniently through JSON and expression trees

I need to evaluate some data. The rules how it should be done are changing frequently (it's an evolving model) so I don't want to rewrite my application each time such a change comes. I'd rather do it ...
t3chb0t's user avatar
  • 44.7k
4 votes
1 answer
360 views

Dynamic setting names based on properties

In one of my frameworks that I use with many tools I have an ExpressionVisitor whose job is to resolve the exact property, it's declaring type and instance. I ...
t3chb0t's user avatar
  • 44.7k
1 vote
1 answer
490 views

Expression tree in Haskell with support for differentiation

A simple binary expression tree in Haskell without operator precedence and without parentheses. Any comments would be much appreciated. ...
Lumon's user avatar
  • 51
14 votes
3 answers
549 views

Building unusual IComparer<T> from expressions

I've needed a couple of very special comparers recenty and didn't want to implement each one of them every time so I created a builder and a couple of supporting classes that do that for me. Example ...
t3chb0t's user avatar
  • 44.7k
8 votes
4 answers
1k views

Selective updates to immutable types

There is a way in Scala to selectively change a field while making a copy of the immutable object: ...
Dmitry Nogin's user avatar
  • 6,131

15 30 50 per page