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.)
lambda
30,236
questions
0
votes
0
answers
14
views
Attempting to use locally cloned version of Python package in Docker throws metadata error
I am testing an experimental library version and must run it in a docker container locally rather than as a pip install.
As a result, I copy all of the files from the locally cloned library into the ...
6
votes
1
answer
95
views
Returning const reference from lambda stored as std::function segfaults [duplicate]
Here is the code:
#include <vector>
#include <functional>
class TestClass {
public:
const std::vector<int> &getStuff() const {
return callback();
}
protected:
...
1
vote
1
answer
43
views
Different generic type overlap of lamba field and its class
Consider this example (live example):
interface Foo<T>
{
readonly fun: (v: T) => void; // causes error below
//fun(v: T): void; // works
}
function isNumber<T>(foo: Foo<T>...
0
votes
1
answer
52
views
Count the number of arguments in generic lambda
I want to create a function that counts the number of arguments in generic lambda functions. SO user "yuri kilochek" has a great solution Count the number of arguments in a lambda but it ...
1
vote
1
answer
55
views
How to call a function from a function in a class that is called using a button with a lambda in Python3x?
I have a class: MyClassName for example, with two functions: one to calculate a number and one to validate if a group of comboboxes (tkinter) all have selections. I'm also using tkinter for a button ...
2
votes
1
answer
58
views
Compose Conditional Modifier Not Working Properly
I tried making an extension function on Modifier to apply changes to it only if a condition was true, since quite frequently I need to make small changes to a Modifier object in case certain things ...
0
votes
0
answers
26
views
Turborepo / Lamda / Dockerfile - Error Not Finding Internal Package
I have a monorepo using Turborepo that has a Lambda function that depends on an internal package. Basically, something like the following structure...
The service is "resize" and it depends ...
2
votes
1
answer
36
views
Python Split and assign into new Columns
I have been worked in a dataframe with one column which has data for different calls to APIs.
I need to split by "," and add new columns depends of the method's name (each API contains ...
0
votes
1
answer
80
views
Use of lambda to perform basic multiplication
I am trying to do basic multiplication within all the individual elements of this list, but where am I going wrong with using lambda expression here?
inputData = [[2, 3], ["4", 7], [6, 4], [...
4
votes
0
answers
160
views
Using a function's argument to produce the type of another function's argument
Since C++20 abbreviated function templates are available for use with placeholder types in parameter list. And one can declare abbreviated function template g with two arguments of same reference type ...
2
votes
1
answer
95
views
Capture bit-fields by reference in a lambda expression
According to cppreference, bit-fields can only be captured by copy: https://en.cppreference.com/w/cpp/language/lambda. Period.
At the same time, one can see certain scenarios, e.g.:
struct U {
int ...
1
vote
1
answer
106
views
How can I std::move a vector into a lambda function? [duplicate]
#include <iostream>
#include <functional>
int main() {
std::vector<int> integers = {0, 1, 2};
std::function<void()> lambda = [integers] {
printf("vector ...
0
votes
1
answer
107
views
C++: Lambda with conditional capture clause possible?
Is there a way to define a lambda's capture clause (copy vs. reference) conditionally?
Let's say we have a function taking a functor:
template<typename Func>
void takeFunctor( Func&& ...
2
votes
1
answer
90
views
Recasting Variadic Arguments from void** Array in C++
I'm working on a project where I need to convert variadic arguments into a void** array, pass them to a lambda function, and then correctly cast them back to their original types for use in a custom ...
0
votes
2
answers
102
views
Google Sheets sum every Nth element from a range up to M elements
I need to calculate the sum of M elements from every Nth row from data set (column A) starting from current cell's row (column B).
I've managed to do that via nested queries, but the performance is ...