Tagged Questions
3
votes
1answer
76 views
How could the command pattern be replaced by lambda expressions?
This is kind of a follow-up to another question (Reuse code for looping through multidimensional-array) where my specific problem was resolved by using the command-pattern. My problem was, that I had ...
3
votes
1answer
24 views
How does Binary Lambda Calculus encode parenthesis?
How does the BLC encode parenthesis? For example, how would this:
λa.λb.λc.(a ((b c) d))
Be encoded in BLC?
Note: the Wikipedia article is not very helpful as it uses an unfamiliar notation and ...
1
vote
2answers
46 views
replace functions with a different function in python
I have a function called get_account(param1,param2)
in run time I need to replace this function with the function mock_get_account(param1,param2)
so when the system calls get_account(param1,param2) I ...
1
vote
0answers
58 views
Zipping streams using JDK8 with lambda (java.util.stream.Streams.zip)
In JDK 8 with lambda b93 there was a class java.util.stream.Streams.zip in b93 which could be used to zip streams (this is illustrated in the tutorial Exploring Java8 Lambdas. Part 1 by Dhananjay ...
3
votes
2answers
69 views
Writing an inverse function in javascript?
I ran into a situation at work today where I needed to write the inverse of a function that I had already written, but I found it inefficient to write the inverse manually because it seems like I ...
18
votes
2answers
736 views
How to compare two functions for equivalence, as in (λx.2*x) == (λx.x+x)?
Is there a way to compare two functions for equality? For example, (λx.2*x) == (λx.x+x) should return true, because those are obviously equivalent.
22
votes
1answer
652 views
Which GoF Design pattern will be changed or influenced by the introduction of lambdas in Java8?
Many claims that the biggest part of the GoF design patterns are just workarounds for the absence of first class functions. Now that Java is about to get lambda expressions, which of those patterns ...
3
votes
2answers
67 views
How to express let* as a lambda expression (not the regular let)
I have a scheme related question, how can we implement let* as a lambda expression. To be more precise, I am not wondering about the "regular" let, but the let with * which lets us use one let ...
1
vote
1answer
57 views
Simply Scheme Chapter 09. Lambda. Any more Lambda exercises?
Greets,
Reading Simply Scheme Chapter 09 and from what I can see, Lambda seems important. I'd like to practice it to the bone so I'm looking for beginner exercises (preferably non recursive) vis à ...
19
votes
2answers
935 views
How does this lambda/yield/generator comprehension work?
I was looking through my codebase today and found this:
def optionsToArgs(options, separator='='):
kvs = [
(
"%(option)s%(separator)s%(value)s" %
{'option' : ...
2
votes
3answers
205 views
C++11 lambda fuction - how to pass parameter
I used lambda function to pass it to std::condition_variable wait() function, but that is not the case. I use lambda functions that don't receive any parameters, and everything is absolutely clear for ...
4
votes
1answer
79 views
How can I simplify this methods expression parameters?
Is there anyway I can change this method to not need the object but just pass a parameter expression:
protected void FillInTextFor<T>(T obj, Expression<Func<T, object>> property)
{
...
1
vote
4answers
96 views
case statements in lambdas
Is it possible to incorporate case statements in a lambda?
I'm trying to make a function that recursively adds two numbers recursively in Erlang with no luck.
Mult = fun(X) -> (fun(Y) -> case ...
-3
votes
2answers
79 views
In python list consist an element 0 is not included in filter function,Why? [closed]
>>> print filter(lambda x:x,[4,0,4,0,0,2])
[4, 4, 2]
5
votes
1answer
328 views
Boost Lambda/Phoenix - how to do lambda which returns another lambda?
Does Boost Lambda/Phoenix supports out of box something like lambda which returns another lambda?
For instance, that can be used to do some kind of currying:
std::cout << [](int x){return ...