I was playing around with ES6 arrow functions, currying and partial application and I decided to try a functional implementation of the FizzBuzz problem:
function* range(start, stop) {
for (var i = start; i < stop; i++)
yield i
}
var map = fn => res => x => fn(x) ? res : null
var isDivide...
I have the following 'interface' to the C++ std::list, I was wondering how I could make it go faster. In particular, it needs to be able to evaluate up to two million operations in a matter of a couple seconds. Right now it's at around 8 seconds.
#include <iostream>
#include <list>
int main()
...
@JeroenVannevel If the second loop removes the def one, then I would expect it to throw an exception.
but it doesn't do that as the first loop has already removed it.
The first one never throws as it is iterating over the indexes and not the list itself. In that one there's a risk that you might skip over one item though.
I am accessing windows form and it has third party Grids. Need to automate and test on grids using CodedUI. The grids are not detected on playback recording. I need to loop through the rows and update. There are 250 rows and while looping it takes so much time. How to effectively loop through row...
I built a small app that gets data from a remote json file and displays it in a list of users. In each list item, an image of the user, their name, and their points tallies are shown.
The list is displayed in two possible ways - 'all time' and 'recent' - depending on the user's choice.
I would ...
As an interesting sub-part of an interpreter -- just the Read part of the REPL --, I present my raw-mode line-oriented editor that I intend to use for my APL interpreter. It defines a large character-translation table to coordinate the input-form/internal-rep/output-form for "normal" keyboards an...
I'm learning C and one of the questions I've been asked is converting a string to an integer. The code I've written supports converting from a string in any base up to 16/hex to an integer. There is no over/underflow checking and it does not support lowercase hex.
int ASCIIToInteger(char *x, i...
@Malachi Yeah, a skim over her profile found you answered her top rated question, and the topic was the same so I figured you'd help anyway, but that's a bit different...
Heres the idea
Write a program that takes two integers, N and M, and find the largest integer composed of N-digits that is evenly divisible by M. N will always be 1 or greater, with M being 2 or greater. Note that some combinations of N and M will not have a solution.
Example: if you are given an...
so I wrote a function that basically works like sprintf, but instead returns the formatted string (std::string). I haven't worked on this long, and I'm aware there are tons of improvements that could be made (alloc/realloc perhaps?). I was just looking for some advice before taking the next step....
I think it might be okay. The OP is asking for practices on their modules, yes, but I've seen many "Is my code modular?" questions. Maybe if the OP also adds that they are looking for a general review, it would be okay.
@kfx Indeed CodeReview can be a fine place to ask if you are also interesested in overall improvements too, not just modularization. — Caridorc5 secs ago