Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [lambda]

DO NOT USE FOR THE AWS SERVICE (use [aws-lambda] for those questions!) Lambdas are anonymous functions or closures in programming languages such as Lisp, C#, C++, Lua, Python, Ruby, JavaScript, Java, Excel or Google sheets. (Also, lambda expression.)

4,503 questions with no upvoted or accepted answers
12 votes
2 answers
5k views

Google Sheets' Lambda Function

Can someone help me figure out how Google Sheets' inbuilt Lambda function works? There is no official documentation for it and the only information available is as in the below snapshot. When using ...
Faisal Ansari's user avatar
10 votes
1 answer
221 views

Why does a variable refer to the variable outside of a lambda, if it is not odr used?

Look at this example (godbolt): void foo(int &par) { auto l = [par]() { decltype(par) x; }; } This program does not compile, because the par in decltype(par) refers to the ...
geza's user avatar
  • 29.3k
10 votes
3 answers
948 views

Why is compiling a code affecting lambda to std::function so slow, in particular with Clang?

I discovered that compile time of a relatively small amount of code, converting lambda functions to std::function<> values, can be very high, in particular with Clang compiler. Consider the ...
prapin's user avatar
  • 6,724
10 votes
1 answer
1k views

Cannot compile method reference in JDK 11

I am currently migrating a project to JDK 11 and compiling it with Maven. However, Maven throws a wobbly over a single method reference (it doesn't have issues elsewhere). The method in question looks ...
Druckles's user avatar
  • 3,622
9 votes
0 answers
1k views

Does this lambda implicitly capture `this`?

My linter claims that the lambda in the following code implicitly captures this (and wants to have that capture specified explicitly). Is that correct? template <class X> struct OtherTemplate { ...
Max Langhof's user avatar
  • 23.6k
9 votes
0 answers
2k views

Remove function argument after setting it to a value with functools.partial

I would like to use functools.partial to set a certain argument to a constant and at the same time remove the argument altogether. Let me explain it using a simple example. from functools import ...
johnbaltis's user avatar
  • 1,559
9 votes
0 answers
2k views

Unable to use forEach and lambda in android min sdk version less than 24

I am using jack compiler in my android project. My min sdk is set to 18. I am unable to use forEach and lambda in my code. It asks me to change my min sdk to 24 or higher. I was hoping that with the ...
Karu's user avatar
  • 1,005
8 votes
1 answer
2k views

How to make prediction with sagemaker on pandas dataframe

I am using Sagemaker to train and deploy my machine learning model. As regard to prediction, it will be executed by a lambda function as a scheduled job (every hour). The process is as follows: pull ...
ddd's user avatar
  • 4,969
8 votes
0 answers
5k views

Using Moq, how to mock a method with lambda arguments

I have a fallowing method in my Repository class: public virtual IEnumerable<T> GetAll(Expression<Func<T, bool>> where = null, Func<IQueryable<T>, IOrderedQueryable<T>...
A.Kostadinov's user avatar
7 votes
0 answers
3k views

How can I access a folder outside of the terraform root module?

I am trying to deploy a lambda using terraform. One of the steps in the lambda module zips up the source folder for the lambda. However, when I run the following code I am met with this error: Error: ...
Jambla's user avatar
  • 448
7 votes
0 answers
510 views

Is it bad practice to make lambdas mutable?

The following lambda doesn't compile: auto l = [a = std::vector<int>() ] { a.resize(1); } ; That is because the variable captured by value a is ...
lezebulon's user avatar
  • 7,875
7 votes
0 answers
99 views

why does friend declaration on a lambda does not work on gcc

See this simple example, constexpr auto f = [](const auto& foo){ foo.fun2(); }; struct Foo{ friend decltype(f); void fun1() const{ f(*this); } private: void fun2(...
Hui's user avatar
  • 581
7 votes
0 answers
4k views

Explicitly Specifying Lambda Parameter Types in C#

I am learning Lambda of c#, say I am Having: void Foo<T> (T x) {} void Bar<T> (Action<T> a) {} Are the following 3 expressions exactly the same thing? Bar<int> (x =&...
Huibin Zhang's user avatar
  • 1,112
7 votes
0 answers
1k views

Compile Java 8 Android library to be consumed in Java 7

Let's say I am making an Android library (to be distributed as a .aar) and I want to use Java 8 language features in my internal library code. Basic stuff like lambdas, etc. In my experience, if I ...
Sam Stern's user avatar
  • 25k
7 votes
1 answer
7k views

ASP.NET, Kendo UI, CS1660: Cannot convert lambda expression to type 'string'

SOLUTION AT THE BOTTOM OF POST I've been struggling to view my data through a Kendo.UI grid for few days, guess I fail to understand some basic concept on how to do it since I'm new to aspnet and all ...
evictednoise's user avatar

15 30 50 per page
1
2 3 4 5
301