Tagged Questions
2
votes
2answers
40 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
49 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 à ...
16
votes
2answers
354 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
139 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
73 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
91 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
70 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
247 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 ...
3
votes
1answer
47 views
Lambdas in Salesforce Apex
Does Apex support the concept of lambdas?
Ultimately, I am trying to DRY up some really repetitive code in my tests, so I'd love to be able to pass functions around, something like this (C#-esq)
...
2
votes
1answer
92 views
How to use lambda as lexical scope in C++
The codes are like this:
int a = 1;
auto f = [a] {return a;};
a = 100;
std::cout << f() << endl;
return 0;
I expected to see 100 as the result. However, the a is like freezed when ...
2
votes
1answer
156 views
Overloading on callable with callable parameter
I am trying to translate C# code like below to C++:
void SomeCall(Action action)
{
// do things like action();
}
void SomeCall(Action<Action> action)
{
// define some action1
// ...
6
votes
1answer
228 views
Will I be able to use Clojure functions as Lambdas in Java 8?
I use a number of libraries in Clojure that produce higher order functions that conform to the "clojure.lang.IFn" interface.
It has multiple arity overloads, I.e. the interface looks something like:
...
-1
votes
2answers
124 views
What is lambda in scheme [closed]
I am VERY new to scheme. Very basic question for everyone. What is lambda in function calls I see everywhere online? What does it do? What do I lose by not using it?
2
votes
2answers
330 views
Prolog - Multiply a list with an element results with a weird tail?
I want to multiply two lists , where I take the left list and multiply it by each element of
the right list .
For example :
multLists([3,4,2],[4,7,8],R).
R = [[12,16,8],[21,28,14],[24,32,16]].
...
2
votes
3answers
119 views
What does the use of multiple lambdas in scheme mean?
I am currently learning scheme and I came across these functions:
(define t (lambda (x) (lambda (y) x)))
(define f (lambda (x) (lambda (y) y)))
Apparently they are representations of true and ...
7
votes
2answers
453 views
Defining a stack data structure and its main operations in lambda calculus
I'm trying to define a stack data structure in lambda calculus, using fixed point combinators. I am trying to define two operations, insertion and removal of elements, so, push and pop, but the only ...
3
votes
1answer
204 views
factorial function for Church numerals
I'm trying to implement the factorial lambda expression as described in the book Lambda-calculus, Combinators and Functional Programming
The way it's described there is :
fact = ...
-2
votes
1answer
108 views
Limit to Number of Nested Function Calls in Python
Just a warning, this code is ugly. I know there are better ways of doing this but this is just an exercise.
I am poking around with the functional programming side of python, but I keep encountering ...
1
vote
2answers
108 views
Equivalent to Lambda Expressions in Python
A common operation I perform is joining a list of lists of letters into a list of words (strings).
I normally use a list comprehension:
lists_of_letters = [["m", "y"], ["d", "o", "g"], ["s", "k", ...
2
votes
4answers
123 views
Do Predicates or Actions have any additional properties or qualities which differentiate them to Funcs?
A Predicate is just a Func which returns a boolean:
Predicate<T1, T2, T3, ...,Tn> = Func<T1, T2, T3, ...,Tn, bool>
And an Action is just a Func which doesn't return a value:
...
1
vote
1answer
131 views
Why is LINQ not purely functional? [closed]
So, why exactly is LINQ not considered purely functional?
Is it because side effects can occur? Or is it maybe because it exists in an imperative environment?
2
votes
4answers
170 views
Functional python programming and conditionals
I'm trying to write a python function in a functional way. The problem is I don't know, how to transform an if conditional into a functional style. I have two variables: A and C, which I want to ...
0
votes
0answers
306 views
How will JDK8's lambdas be integrated into Scala? [closed]
Will lambdas in the upcoming Java 8 benefit Scala which already has them? For example, will its collections adopt the lazy until sink chaining (with choice of final container) of Java's implementation ...
1
vote
0answers
157 views
Lambda functions to implement functional port of D3.JS to C++11
Would the lambda functions of C++11 be able to handle the functional aspects of D3.JS if one were to attempt a partial port to C++?
What sort of functional programming and loose typing features will ...
6
votes
2answers
177 views
What is more pythonic - function composition, lambdas, or something else? [closed]
Given the example below, which is more pythonic? Using function composition, lambdas, or (now for) something completely different? I have to say that the lambdas seem to be more readable, but Guido ...
0
votes
2answers
120 views
LambdaJ: why can't we apply operation in select clause?
select(list, having(on(Integer.class).intValue() % 2, equalTo(0)));
the code above throws exception.
6
votes
2answers
746 views
why do lambda functions in C++11 not have function<> types?
I am playing around with the C++0x/C++11 functional features. One thing I find odd is that the type of a lambda function is actually NOT a function<> type. What's more, lambda's do not seem to play ...
0
votes
1answer
177 views
c++ what is meant by 'retain state' ?
I read this explanations on MSDN pages, for advantages of lambda expression over functor and function pointer. What is meant by ability to 'retain state' ? Is it related to capability to capture some ...
1
vote
8answers
389 views
Lambda Expression conversion for a loop to display a list
I am trying learn the use of lambda expressions and hence still struggling to implement after even reading the documentation and other various related articles on it.
So if I want to convert this ...
1
vote
3answers
279 views
Take inverse of a function in Racket
I am trying to write a higher-order Racket function that takes a first-order function of one variable and returns its inverse. I know that it has to start off something like this:
(let [(inverse ...