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,117
questions
0
votes
0
answers
19
views
Read Large JSON File and Flatten Lambda
I have a lambda function that reads in a json file and flattens it so that I can convert it to parquet and it'll be easier to read the data. The issue I'm having is that some of the files are too ...
5
votes
1
answer
77
views
Inaccurate compile-time computation of Fibonacci sequence in a recursive lambda
Below is a recursive lambda expression that can compute the values of Fibonacci sequence both in runtime and during constant evaluation:
auto fib = [](this auto && f, auto && p) {
...
0
votes
0
answers
14
views
AWS Lambda python log file is not created
I have a Python AWS lambda with a logger that generates two different log files:
LOG = f"/tmp/{uuid.uuid1()}_log.log"
SLOW_LOG = f"/tmp/{uuid.uuid1()}_slow.log"
logging....
-2
votes
0
answers
62
views
Why is static lambda constructed more than once in cpp? [duplicate]
Run this code:
#include <iostream>
void Func(size_t i) {
static auto lambda = [&i]() {
std::cout << i << std::endl;
};
lambda();
}
int main() {
for (...
-2
votes
2
answers
69
views
Clarity on Java Lambda Syntax [duplicate]
From my understanding, this is a single statement in Java:
while((x % p == 0l) && (x > p)) x /= p;
If that is the case, why is this a syntax error:
final AtomicLong subtotal = new ...
-5
votes
0
answers
63
views
I am trying to understand lambda.... why can I not print a list directly when it has been populated by lambda? [closed]
The following is the code I found in a learning website.
callables = []
for i in (1, 2, 3):
callables.append(lambda a=i: a)
for f in callables:
print(f())
Why can we not print the callables ...
0
votes
0
answers
88
views
Does the C++ standard library have function types that are non-copy-constructible?
I want to pass a bunch of lambdas around without having to make copies.
This is the declaration of one of the lambdas
[
promise = std::move(promise),
namedSeries = std::move(namedSeries)
] ...
0
votes
0
answers
30
views
{"message":"Forbidden"} when navigate to another page for nextjs 14 app deployed to aws lambda integarted with api gateway
My frontend uses nextjs 14 with a Docker file, github actions build and push the docker image to aws ECR, cloudformation retrieve the docker image from ECR and create lambda function and its ...
0
votes
0
answers
32
views
How can i correctly use lambda function or CC_CALLBACK Macro for getting input from the user in cocos2d-x?
I am developing a game using cocos2d-x, in which i am trying to get input the path for the directory where i can save the game files. i have implemented it using UI Text Field and Menu Item but ...
-1
votes
0
answers
40
views
GoogleSheets ordering matrix columns of 3
I have a dataset organized into 3 columns, being the first row the title.
Data is organized by category DC,PH,DA,PF and date. But imputed in a randomly order
Notice there are 147 columns and 127 rows, ...
0
votes
2
answers
47
views
Transformations on Multiple Columns in Pandas Dataframe
Using the pandas framework in Python, I need to apply a transformation on 4 columns (Col1, Col2, Col3, Col4 in example Code) in a table.
The Transformation is quite simple:
Extract a Unix Timestamp
...
0
votes
2
answers
43
views
Building a C# equivalent of the SQL Server construct IN?
Often in SQL Server, I use IN to check if a value is in a list of items, for example:
WHERE @x IN (1, 2, 3, 5, 8, 13)
I've got as close as I can by defining the following in a library function, thus:
...
0
votes
1
answer
36
views
Building a generic search for RavenDb - failing to create Expression<Func<T,object>>
The standard search method on IRavenQueryable looks like this:
public static IRavenQueryable<T> Search<T>(this IQueryable<T> self, Expression<Func<T, object>> ...
2
votes
1
answer
120
views
In GCC, inside a lambda, I can get constexpr variable from a non-constexpr template lambda, but not in Visual C++
This code compiles fine in gcc, but fail in Visual C++.
MCVE = https://godbolt.org/z/K7d5PEs65
int main(){
int localVariable=0; //some local variable
auto lamb=[&]<int s>() {
...
1
vote
2
answers
60
views
get constexpr variable from a lambda function is fine , but compile fail (Visual C++) and fine (gcc) when such statement is in a new lambda
This code compiles fine in gcc, but fail in Visual C++.
MCVE = https://wandbox.org/permlink/SqNI85EospSrwm5T
int main() {
auto func_do1Pass2=[&]() {
return 8;
};
constexpr int ...