Skip to main content

Questions tagged [lambda]

Use this tag if you would like to discuss the appropriateness of a lambda (anonymous) function in your code.

19 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
297 views

Create 'classical' visitor from lambdas

I've watched a talk by Fedor Pikus on design patterns held at CppCon 2019. Motivated by this, I wrote my own visitor implementation and some helpers which allow me to create a visitor from a couple of ...
StefanKssmr's user avatar
4 votes
0 answers
80 views

Print columns of text without hard coding the width (attempt 5)

If you'd like to print this: ...
candied_orange's user avatar
3 votes
0 answers
1k views

AWS Lambda Function to Register in Cognito

This is the entire code for a Lambda function that registers a new user in Amazon Cognito. The email, username, and password are passed to the Lambda function. The client ID is stored in an ...
Lou Bagel's user avatar
  • 461
3 votes
0 answers
63 views

Designing a system to apply multiple effects to one or multiple targets

I posted this on SO first, but was redirected here, since the code below already works: I'm currently trying to develop a small game as a hobby project, which contains an automated combat system ...
Iavra's user avatar
  • 31
3 votes
0 answers
224 views

Generic Factory using Function library

Here's my implementation of Generic Factory using Function library. It was created using Function library because I understand that the newInstance method is ...
Arigatonic's user avatar
2 votes
0 answers
41 views

Lazy evaluation vs strict one applied to fib

I have this OCaml problem: Recall the polymorphic type lazy seen in class, the function delay which transforms a ...
V_head's user avatar
  • 525
2 votes
0 answers
1k views

Lambda@Edge function for handling redirects and rewrites

We're converting the City of Philadelphia's website to be served as static files. In order to support redirects and rewrites (URL masking), we decided to use a Lambda@edge function, which modifies (or ...
Tobias Fünke's user avatar
2 votes
0 answers
181 views

Handling IndexError using lambda function within scrapy

I've written a script using python's scrapy library to parse some fields from craigslist. The spider I've created here is way normal than what usually gets considered ideal to be reviewed. However, I'...
SIM's user avatar
  • 2,501
2 votes
0 answers
249 views

Comparing speed of common sorting algorithms in an extensible way

I have written a program with the goal of comparing the speed of some common sorting algorithms. It works with many data types. ...
esote's user avatar
  • 3,770
2 votes
0 answers
582 views

Flattening a map into a list of records

In my everyday work I'm trying to move away from traditional iterating over collections to a more Java 8 streams-like behavior. I'm currently working on a project where I have a collection defined as: ...
Jiinxy's user avatar
  • 129
2 votes
0 answers
43 views

DynamicIterable

I have written this DynamicIterable that can be used as a Lazy Iterable, where you give it a Supplier<T> of something and ...
Edu G's user avatar
  • 121
2 votes
0 answers
365 views

unordered_multimap approach to adjacency list and graph search

I'm looking for suggestions on how to improve the usage of modern C++ features with this simple graph search algorithm, particularly with regard to the use of STL containers and lambda expressions. ...
user11881's user avatar
  • 393
1 vote
0 answers
71 views

A recursive_transform template function for the binary operation cases with execution policy in C++

This is a follow-up question for A recursive_transform template function for the binary operation cases in C++, A recursive_transform Template Function with Unwrap Level for Various Type Arbitrary ...
JimmyHu's user avatar
  • 5,214
1 vote
0 answers
45 views

Fetch the nearest city, optimised with Redis on a Lambda

I have a lambda function which returns the nearest city from a latitude and longitude. My algorithm for this is resource heavy and time consuming. To optimise this, I hash the coordinates into a 6 ...
Will's user avatar
  • 111
1 vote
0 answers
111 views

A Generic Two Dimensional Data Plane with Common Math Calculation Build-in Methods in C#

This is a follow-up question for A Generic Two Dimensional Data Plane with SubPlane Method in C#. Thanks to aepot's answer. I am trying to implement a series methods to enhance the ability and ...
JimmyHu's user avatar
  • 5,214
1 vote
0 answers
125 views

A Bspline module for AMO

Here is a (reduced version of) a module for Bsplines, which I have used multiple times for my work on Atomic, Molecular, and Optical physics (AMO, in the trade lingo, a.k.a. "I love", in ...
Luca Argenti's user avatar
1 vote
0 answers
77 views

A recursive_replace_copy_if Template Function Implementation in C++

This is a follow-up question for A recursive_copy_if Template Function Implementation in C++. Besides the recursive version std::ranges::copy_if, I am trying to ...
JimmyHu's user avatar
  • 5,214
1 vote
0 answers
2k views

Opencv forEach with lambda expression for parallel processing

I'm using forEach function to access pixels in parallel like so: ...
Ja_cpp's user avatar
  • 341
-2 votes
1 answer
71 views

Printing the steps of a function composition

I have this code: ...
Dheraj Dhruv's user avatar