A lambda is an expression that acts as an anonymous function. Use this tag if you would like to discuss the appropriateness of a lambda or anonymous function in your code.

learn more… | top users | synonyms

1
vote
1answer
34 views

Validate fields in Python dictionary using dictionary of lambdas

I would love some feedback on this. I use it to validate web-form objects before persisting them in the dangerously-lazy MongoDb. I have a class and many validators for each of my collections. Is ...
2
votes
1answer
22 views

Tridiagonal Lists in Scheme

...
2
votes
2answers
122 views

Sum(), ForEach() with Lambda in a hierarchical List Collection

I have to list the number of documents related to items in a hierarchical tree. The specification states: The tree will only ever be 2 levels deep. The higher level items will list not only the ...
13
votes
1answer
165 views

Python Dictionary Black Magic

I am defining a subclass of a the python dictionary object mpCmd where every item is converted to a lambda. The intended usage is that every item in the dictionary ...
2
votes
2answers
75 views

Mixing Linq queries and Linq lambdas

I have been given a change to rewrite an old framework we use, and to implement the repository and unit of work patterns, but in an attempt to not rewriting all queries I have ended up with a weird ...
11
votes
6answers
691 views

Increment up the build number in AssemblyInfo.cs on every build

I just wrote this short little program to increment up the build number for my projects every time I build them. After compiling this exe, I just call it in the pre-build command line. I did take ...
17
votes
2answers
375 views

Dynamically call lambda based on stream input

Some context: I have code that looks like this (minor issue noted here): ...
12
votes
3answers
327 views

Java 8 Effective Use of Multiple Streams

I am experimenting with streams and lambdas in Java 8. This is my first serious foray using functional programming concepts; I'd like a critique on this code. This code finds the Cartesian product of ...
9
votes
2answers
177 views

Basic Rock-Paper-Scissors implementation

So I decided to try to make a simple RPS implementation in Java 8, the following notes should be said first: At a later point it should support RPSLS aswell, as any other Gesture-game variant. At a ...
5
votes
2answers
61 views

Beta Reducer in Haskell

This is my first Haskell application, so any non-name-calling tips will be taken extremely well! It is just a beta reducer: ...
5
votes
1answer
53 views

Combining contents of files by reading them in a human ordering

This code review is inspired by the this StackOverflow question and written in Java 8. The code is supposed to: Order all files, with syntax jobXXX.script, where ...
3
votes
2answers
40 views

Elegant way of making a List of an attribute from a list of objects containing that attribute

If this is my class: class Something { UUID id; // Other members } Given a List<Something> things and I want to ...
4
votes
2answers
155 views

Project Euler “Largest product in a grid” (#11) in Java 8

I have come up with a Java 8 solution for the following problem: In the 20×20 grid below, four numbers along a diagonal line have been marked in red (bold here). 08 02 22 97 38 15 00 40 00 75 ...
5
votes
1answer
742 views

A generic way to use LINQ to Entity with types and operations unknown until run time

A question was asked here about reflection and LINQ to entity. I'm trying to modify the code that was presented to fit my needs, but it appears both Smeegs and Servy are quite a bit smarter than I am ...
3
votes
0answers
75 views

Elixir pipes and anonymous functions

I recently got started with Elixir. I'm used to F#'s pipes, and Seq.map and LINQ's .Select statements. Things are different in ...
2
votes
2answers
92 views

Unwanted return values in lambda functions?

From a previous question, I got the idea of moving boilerplate code structures into a helper function and passing in a lambda function to it. I then applied the idea to a data access class (code ...
3
votes
2answers
750 views

C++11 factory pattern with lambdas

Anonymous functions are one of the best features of C++11. They make everything so beautiful! However, one can get carried away and start overusing them. This code calls a function that reads ...
1
vote
1answer
184 views

Excessive use of lambda with variant of Sieve of Eratosthenes?

This is a function which produces the sum of primes beneath (not including) a certain number (using a variant on the sieve of Eratosthenes). ...
6
votes
1answer
909 views

Fixed point combinator in C++1x

This has been tested and compiled under Visual Studio 2010. Are there any serious problems with this implementation? PS. This implementation is fully lambda expression based. If I can make ...