Questions tagged [lambda]
Lambdas are anonymous functions (i.e. not having an identifier, like methods in a class) which can be used in a wide range of programming languages.
92 questions
2
votes
2
answers
309
views
Why does a Java lambda need to explicitly mention the method of the functional interface?
import java.util.function.Function;
public interface Printable {
public String print(String s);
public static void main(String[] args) {
Function<String, String> fn = p -> p +...
-2
votes
2
answers
240
views
Quiz Site Software Architecture Question
I am currently writing an application that is going to be an adaptive quiz-like site for studying. The idea is a user is studying some topic and they are given questions on the site and enter their ...
0
votes
0
answers
91
views
Lambdas vs scope blocks for encapsulation in c++
When working with functions that run a few short "procedures" in sequence that are not used anywhere else and it makes sense to keep it all inline, in a single function, a large part of the ...
1
vote
1
answer
777
views
Is using lambdas and overload resolution a recommended way to write a visitor for a variant?
If I have a discriminated union and want to write a function piecewise, the following code works just fine, but is taking advantage of some fairly tricky (at least to me) stuff involving overload ...
1
vote
0
answers
64
views
Designing an architecture for running multiple scripts
Our company is an aggregator of multiple payment services fragmented on the web. So instead of businesses integrating multiple services one by one, they will only need to integrate to our API, and we ...
9
votes
5
answers
835
views
Re-architecting CPU intensive Node application to handle multiple users
A few years ago, I wrote an application that allowed users to upload a file (it's a very specific file type) to a server. It then sends instructions to the server on how to visualise the data, and the ...
0
votes
1
answer
1k
views
Capture by value/reference and early/late binding
Is capture by value (x below) an early binding and capture by reference (y below) a late binding in C++ lambdas, or are they both early bindings—the first by value and the second by reference?
#...
1
vote
2
answers
624
views
How do the SOLID principles apply in the context of Lambdas and Streams? [duplicate]
How are these principles applied in the context of streams and lambda expressions? In particular, the applicability with respect to the following three principles: - Single Responsibility Principle (...
4
votes
2
answers
494
views
Robust way to aggregate results from 2 AWS lambdas for a SPA
I'm new to AWS serverless applications and am looking for something like ocelot request aggregation on the AWS serverless stack.
Assume I have two AWS lambdas that return data needed by a SPA: A and ...
1
vote
0
answers
514
views
Implement multiple file upload with Dropzone.js , Lambda and S3
This is more a general question about this project I have on. We need to implement some UI for our costumers to upload multiple files (2000+) every month, so we can send them by email to another ...
4
votes
3
answers
1k
views
how to pass credentials to api gateway securely?
I have a code at my local machine, with which I want to call an AWS Lambda function.
I have configured AWS API Gateway as doorway to Lambda function, but I am concerned about security when sending ...
3
votes
1
answer
151
views
Run a job every hour with Lambda or something else?
I am working on a SaaS project that will have a trial when the trial is ending I get a webhook notification when 3 days are remaining. I do some stuff with this and one of the things is I update user....
0
votes
2
answers
117
views
Make lambdas concise using enumerations?
Generally, we are looking to create a logging framework that can target human readable output as well as various structured data formats. So, a goal is minimizing code duplication in packaging the ...
2
votes
0
answers
166
views
Is there an accepted Coding Style for multiple ES6 Arrow Functions?
I'm starting to use ES6 arrow functions more, but haven't found a coding style that I like, especially when chaining them together. e.g., Eric Elliott gives this code:
mix = (...fns) => x => ...
6
votes
2
answers
3k
views
Using lambdas to improve readability of a C++ function
I'm looking to improve the readability of a lengthy C++ function. This function contains a number (> a dozen) variables that are used throughout. The main logic of the code is a long list of condition ...
2
votes
0
answers
572
views
Designing large nanoservice architecture with AWS Lambdas
I'm moving from a coupled architecture to a decoupled architecture using microservices with AWS Lambda.
Here is my current architecture:
Each API Gateway route is linked to a specific Lambda, each ...
13
votes
3
answers
4k
views
In Java 8, is it stylistically better to use method reference expressions or methods returning an implementation of the functional interface?
Java 8 added the concept of functional interfaces, as well as numerous new methods that are designed to take functional interfaces. Instances of these interfaces can be succinctly created using ...
2
votes
2
answers
850
views
Unknown number of arguments in currying
Hypothetical situation - can a currying function have an unknown number of arguments (kind of like varargs)
Eg in Python:
addByCurrying(1)(2)(3)(4)
Should equal 10
addByCurrying(5)(6)
Should equal ...
8
votes
0
answers
834
views
What lambda function optimizations, if any, are planned for Java 9 and beyond? [closed]
I'm working on a high-performance project where Java 8's lambda functions are enormously useful. I've found, however, that they're memory inefficient when used en masse. For example, suppose I need to ...
0
votes
2
answers
4k
views
Lambda calculus: Call by value / Call by name (lazy)
Having difficulties deciding which rules to apply on by value / by name evaulation.
Say I have:
(λz.zz)(λb.b)
And I want to evaluate according to call by valute, will the next step be
(λz.z)(λb.b)
...
2
votes
2
answers
3k
views
Java - Using a Function variable to set the toString() method's return value
Lately I've started adding this to certain classes in an in-house API:
public class MyClass {
// I usually do this with classes I expect to
// be printed out or tested a lot (particularly
// ...
8
votes
1
answer
5k
views
C++11 Lambda vs Helper Member Functions
There are a bunch of methods in a class that I want to clean up. These just build up a data structure (with different values) over and over again and add them to a container passed in, like so:
...
4
votes
1
answer
3k
views
Lambda Return Type Inference
Writing my own JVM compiler, I am facing a giant problem that I am desperately unable to solve:
Lambda Return Type Inference
1. Overview of the compiler lifecycle
More specifically, the order in ...
3
votes
2
answers
424
views
Functional Programming style: How to write functions - explicit currying, implicit currying or lamdas?
So I have been using F# for a while and studying a bit of Haskell on the side and I have realized I could rewrite the exact same function one of three different ways.
Either with implicit currying, ...
14
votes
2
answers
4k
views
Is this a good pattern: replacing a long function with a series of lambdas?
I recently run into the following situation.
class A{
public:
void calculate(T inputs);
}
Firstly, A represents an object in the physical world, which is a strong argument for not splitting the ...