Category "lambda"

Search an array list inside another array and return a new object combined

I am using typescript and I have two objects: export interface Module { moduleId: String name: String } export interface Model { id: number name

Java 8 optional: ifPresent return object orElseThrow exception

I'm trying to make something like this: private String getStringIfObjectIsPresent(Optional<Object> object){ object.ifPresent(() ->{

How to deploy multiple functions using serverless cli?

From the doc, I can deploy a function like this serverless deploy function -f functionName https://www.serverless.com/framework/docs/providers/aws/cli-refer

Conditional branches of a function raise false circle reference errors

I have a big function with lots of branches of IFS; each branch uses different references of the worksheet: MYFUN = LAMBDA(i, IFS( i = 1, // a formu

Simplifying code - perform mathematical operations based on operator

Here is the code for a calculator in Python: import time #Returns the sum of num1 and num2 def add(num1, num2): return num1 + num2 #Returns the difference

Added VPC endpoint but Lambda still timing out

Goal: Lambda function needs to retrieve RDS password from Secret Manager via VPC Endpoint (using AWS-SDK in Lambda). Problem: The Lambda function and RDS are i

coding reduceByKey(lambda) in map does'nt work pySpark

I can't understand why my code isn't working. The last line is the problem: import findspark findspark.init() from pyspark import SparkConf, SparkContext from p

What do the parenthesis following a lambda expression mean?

I am new to Python and I am wondering why this doesn't work for lambda: for person in people: print(lambda person:person.split()[0] + ' ' + person.split()[-

Why does it matter if I use a method reference or a lambda here?

When I try to compile this code import java.util.Optional; public class GenericTest { public static void main(String[] args) { Optional.empty().m

INDIRECT and OFFSET in the function body make a name special

I would like to write a user-defined function CHOOSERANGE that returns a range from 4 coordinates. The first version is as follows: CHOOSERANGE = LAMBDA(row_min

What's the VB.NET equivalent of async delegate in C#?

I'm trying to convert the following extension method (source) from C# to VB: public static Task ForEachAsync<T>(this IEnumerable<T> source,

error: no viable conversion from '(lambda at A.cpp:21:22)' to 'int'

What am I missing? Lambda declaration error. Marked in comment. void solve() { int charCount, time; cin>> charCount >> time; // Generat

Can Python pickle lambda functions?

I have read in a number of threads that Python pickle/cPickle cannot pickle lambda functions. However the following code works, using Python 2.7.6: import cPic

Define a lambda function with infinite number of arguments

Some Excel native functions like VSTACK permit of infinite number of arguments, and they have an intellisense as follows: I would like to know how to define su

Recursive LAMBDA to replace characters by specific substitutes from a lookup table

The goal is to iterate through rows of the character table and replace each character with it's substitute. The character table in this example is ={"&","&a

What is the purpose of std::function, and how to use it?

It is necessary to me to use std::function but I don't know what the following syntax means. std::function<void()> f_name = []() { FNAME(); }; What is

Is it possible to step through a row of data and sum every n-th cell using a Lambda function?

I have a model that produces an array of values that can be several hundred columns wide. Every 25th column contains a number that I need to add to the total. I

How do I use the new computeIfAbsent function?

I very much want to use Map.computeIfAbsent but it has been too long since lambdas in undergrad. Almost directly from the docs: it gives an example of the ol

Merge Map<String, List<String> Java 8 Stream

I would like to merge two Map with JAVA 8 Stream: Map<String, List<String>> mapGlobal = new HashMap<String, List<String>>(); Map<Str

Do lambda expressions have any use other than saving lines of code?

Do lambda expressions have any use other than saving lines of code? Are there any special features provided by lambdas which solved problems which weren't easy