Hot answers tagged

6 votes

Deepest pit of an array

Overall, reading this code, my reaction is "huh?". It looks like a bunch of gibberish at first (and second) glance. There are no english words. I would not want to maintain this code after ...
user avatar
5 votes

Sum two vectors in x86 assembly

A bug Using ebx is OK, but like esi and edi it is a callee-save register, so you should save ...
user avatar
  • 6,359
4 votes

Porting PHP's array_push to Python

The list case. As noted in a comment, you can simplify to this: array.extend(args) The dict case. It looks like the goal is to find the max integer key, if any, ...
user avatar
  • 9,475
4 votes

std::array based push-only circular buffer

Missing Includes It doesn't compile for me without the #include <stdexcept>. Other stuff is luckily included by other includes. I'm personally a fan of ...
user avatar
4 votes

std::array based push-only circular buffer

It's missing a lot of features The parts you have implemented look reasonably OK, but it is missing a lot of features you would expect from a container class. You already mentioned you cannot get a <...
user avatar
  • 32.5k
2 votes

Deepest pit of an array

function deepest_pit(B) { The JavaScript style guide here indicates that camelCase is recommended for functions. JavaScript is ...
user avatar
1 vote

Sum up nested array of objects based on keys

I'm going to make an up-front assumption that many of the truthy checks you're doing (e.g. ... || 0) is simply to check if a value is undefined or not, and you don'...
user avatar
1 vote
Accepted

Sum up nested array of objects based on keys

You are returning a new object in each iteration inside the reducers, when you could use just one object for the tallies (see below). The handling of undefined values suggest to me that the underlying ...
user avatar
  • 600
1 vote

Porting PHP's array_push to Python

Some points to supplement @FMc's answer (though we'll put aside for the moment its excellent advice against mutation): The way you compute keys when extending dictionaries can be tidied with ...
user avatar
  • 533
1 vote

Suggestions for improvement for generic array and map functions in Go 1.18

Right, I've had a closer look at the Map type you posted here (don't know why, but that one piqued my interest more than the list). There's quite a lot to unpack ...
user avatar
1 vote

Merge sort in PHP 5

It appears that you have quite a bit of experience with mergesort in various programming languages. While it may obviously be deemed a bit tangential to the purpose of StackOverflow I can’t help but ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible