The functional tag has no wiki summary.
3
votes
3answers
55 views
GetCommonBaseClass: Readabiliy and Functionality
I have two pieces of they which do almost the same thing. They both return the most common base class of two types. They differ in two aspect:
If one of the arguments is null, code A returns null ...
1
vote
1answer
67 views
Determining function return types for std::function
I'm using the boost::units library (boost::units) and trying to make use of auto and decltype to deal with all the complicated types it produces.
I have a templated function to integrate a ...
1
vote
1answer
27 views
Most concise Python radix function using functional constructions?
The problem with computing a radix using a non-imperative style of programming is you need to calculate a list of successive quotients, each new entry being the quotient of the last entry divided by ...
1
vote
1answer
51 views
mapping & loops - counting up or counting down
I am building a time tracking application and my requirement says that any hours past 40 total should be counted as overtime and not regular hours.
Which function is more clear? What can be done to ...
2
votes
3answers
134 views
Cleaner way for coding a repetitive application of a function
I have this function definition which takes an r and applies the function f n times:
r => (1 to n).foldLeft(r)((rx, _) => f(rx))
So for n=3 this is equivalent to f(f(f(r)))
I don't like this ...