question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support lambda syntax

See original GitHub issue

Support for lambda inside expression, especially to use linq methods like .Where.

See also: http://stackoverflow.com/questions/17540548/dynamic-expresso-foreach-with-lambda/19010667?noredirect=1#comment44094147_19010667

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:4
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
avideniccommented, Jul 20, 2020

Hi,

has anyone had any time to work on this? It has been 5 years =)

Best regards

2reactions
metoulecommented, May 18, 2021

@amoorthaemer

Hi Bert (and all the watchers), I have a working prototype! It still needs some work, but I was able to successfully run the following code:

[Test]
public void Select_inferred_return_type()
{
  var target = new Interpreter();
  var list = new List<int> { 1, 10, 19, 21 };
  target.SetVariable("myList", list);
  
  var results = target.Eval<IEnumerable<char>>("myList.Select(i => i.ToString()).Select(str => str[0])");
  
  Assert.AreEqual(4, results.Count());
  Assert.AreEqual(new[] { '1', '1', '1', '2' }, results);
}

Any example of the kind of lambda you’d want to execute would be helpful.

Note the following limitations:

  • the lambda body can’t be a block
  • it can’t return a new object (no .Select(i => new { Field = i }))
Read more comments on GitHub >

github_iconTop Results From Across the Web

Lambda expressions and anonymous functions
C# lambda expressions that are used to create anonymous functions and expression ... The C# language provides built-in support for tuples.
Read more >
How to Use Python Lambda Functions
In this step-by-step tutorial, you'll learn about Python lambda functions. ... lambda expressions support all the different ways of passing arguments.
Read more >
Lambda Expressions (The Java™ Tutorials > Learning ...
Lambda expressions enable you to do this, to treat functionality as method argument, or code as data. The previous section, Anonymous Classes, shows...
Read more >
Lambda expressions (since C++11)
Lambda expressions (since C++11) ... Constructs a closure: an unnamed function object capable of capturing variables in scope. Contents. 1 Syntax ...
Read more >
Python Lambda
A lambda function is a small anonymous function. A lambda function can take any number of arguments, but can only have one expression....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found