Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
-4 votes
1 answer
86 views

How to convert mathematical expression to lambda function in C++?

I am trying to convert string of mathematical expression to lambda function in C++17. How can I do this type of conversion with function? std::function<void()> str2lambda(const std::string& ...
Kemal159's user avatar
-1 votes
2 answers
76 views

lambda function uses member variable and produces different results

I dont know why the code runs without errors. From what I learned, in functional programming, same input results in same output and function's internal state cannot be changed from outside. When I ...
Deenadayalan's user avatar
-1 votes
2 answers
38 views

Converting lambda to normal def function

I am a beginner programmer and I'm currently watching Bro Code's tutorial on Python. He coded it like this: I was wondering how you would do it with a "def" instead of a lambda and I guess ...
user23546251's user avatar
0 votes
0 answers
20 views

How do I create a parameterized equation with the same coefficient for certain terms?

I'm working on a project that involve the pennylane package for quantum machine learning. However, knowledge of the actual package/quantum machine learning (QML) isn't necessary for the resolution of ...
NikNack's user avatar
  • 23
5 votes
1 answer
168 views

What is the difference between an anonymous function and a function handle in MATLAB?

I hear these two terms, anonymous function and function handle being used to refer to something like f = @(x) x.^2 in MATLAB. But then I've also heard that these terms mean different things. How do ...
Cris Luengo's user avatar
  • 59.4k
3 votes
1 answer
136 views

Why is std::unique() broken for a an equality relationship that changes between elements?

I wrote some code to iterate over a vector. It allows up to two occurrences of each element before considering subsequent occurrences as duplicates. int main() { std::vector<int> vec = {1, ...
ali sedighi's user avatar
0 votes
0 answers
63 views

Using reduce and lambda function to find average grade in a dictionary list

In a dictionary list containing student information like name, age, grade. Use lambda and reduce function to find average grade of all students? I am not able to use the lambda and reduce function to ...
Akshay Sahni 's user avatar
0 votes
0 answers
11 views

Using lambda function to sort dictionary list

A dictionary contains name and age of a person. Use lambda function to filter out dictionaries for age less than 30 and then print the names of person in sorted list with name capitalized and prefixed ...
Akshay Sahni 's user avatar
-1 votes
1 answer
74 views

Why does the lambda "var a: ()->Int = {()->5};" give the error "Expected no parameters"?

Why is this not correct: var a: ()->Int = {()->5}; and this is: var a: ()->Int = {5}; For the first one I get an error in Android studio: Expected no parameters. I don't understand why, as ...
Sanja's user avatar
  • 19
-1 votes
2 answers
47 views

Converting java.util.Function to non-Lambda expression one in Monad example taken from Wikipedia

There is a very simple Monad example, written in Java, which is taken from Wikipedia article. import java.util.function.Function; interface Monad<T> { <U> Monad<U> bind(Function&...
toowren's user avatar
  • 113
0 votes
0 answers
51 views

Why is the passed argument "not defined" in the exec(), even though the argument is defined in the same function?

I'm trying to dynamically create pages when each button is pressed. In the following code I pass the canvas of the current page into the next function so that it can be deleted ( preventing multiple ...
Alex Myladoor's user avatar
0 votes
0 answers
101 views

AWS Amplify Python Rest API breaks the build process

I'm trying to create an AWS Amplify project and for some reason when I add a rest api and choose python the build process breaks. It works fine if I add a NodeJS api though. I tried to just use NodeJS ...
MrCrayon's user avatar
3 votes
1 answer
113 views

Is there a way to use Kotlin lambda to create java.util.funtion.Function?

I tried to write the following code: val s: Function<String, String> = { s -> s + s } It compiles with the following error: Type mismatch: inferred type is (???) -> [Error type: Return ...
Some Name's user avatar
  • 9,347
0 votes
2 answers
262 views

Excel - Stockhistory + VSTACK

I am working on STOCKHOSTORY function to pull stock data of 50+ stocks/tickers ; then i am trying to put them into power query. Issue 1: Every stock history array is placed after certain interval of ...
Mamamiya7's user avatar
3 votes
1 answer
63 views

Conditional operator inside C++ fibonacci lambda

While checking how to implement a recursive lambda function I stumbled upon this solution #include <iostream> using namespace std; int main() { auto fr = [] (int n, auto&& fr) { ...
Cnoob's user avatar
  • 191

15 30 50 per page
1
2 3 4 5
50