Skip to main content

All Questions

5 votes
3 answers
231 views

HackerRank, Haskell simple "compression" algorithm

The question asked is very straight-forward and is simple enough to solve. What I am looking for is that hopefully I can get some understanding for using the constructs and built-ins of the Haskell ...
tijko's user avatar
  • 780
4 votes
4 answers
1k views

Merging sorted integer arrays (without duplicates)

I have written a Python function called merge_arrays which takes two lists and returns the new list merge without duplicate. The function works as expected, but my ...
TAHER El Mehdi's user avatar
1 vote
2 answers
68 views

Imrove performance when updating DataFrame rows based on complex criteria

My question got rejected the last time so I am trying a better approach to getting a solution: ...
PyNoob's user avatar
  • 21
1 vote
1 answer
274 views

Fizzbuzz Solution - complexity, readability, performance, lines, obfuscation... - .sort()

The fizzbuzz challenge presents a lot of interesting questions for 'intermediate' programmers like myself. I have found that I don't actually know where to draw the line with, complex (hard to read ...
Dat Boi's user avatar
  • 121
4 votes
2 answers
3k views

Download entire localStorage as file

I would like to download the entire contents from localStorage to a json file (in a "clear" formatting). I've tried this and it works perfectly. However, ...
Gibberish's user avatar
  • 109
3 votes
1 answer
268 views

Efficiently calculating perfect powers in Haskell

I'm trying to calculate perfect powers to solve this code wars challenge: https://www.codewars.com/kata/55f4e56315a375c1ed000159/haskell The number 81 has a special property, a certain power of the ...
jdkleuver's user avatar
3 votes
0 answers
196 views

Advent of Code 2021, Day 3 in Haskell

This is a working solution to today's Advent of Code puzzle, written in Haskell. However, I feel like this solution is not optimal. ...
Scriptim's user avatar
  • 131
-2 votes
2 answers
111 views

Getting items that have more than one entry in the array with optimized code

...
PDHide's user avatar
  • 123
-1 votes
1 answer
84 views

Simplifying and optimising function logic [closed]

I asked the same question on StackOverflow but was told to instead ask here since it was better suited. I have a function that I implemented. It is doing a lot of heavy lifting. I would like to ...
gameFrenzy07's user avatar
3 votes
1 answer
72 views

Finding the difference between the estimated value and the true value in a reward task

I have this function called error, which estimates value based on previous value and rewards in trials. The difference between the estimated value and true value is then calculated, giving the error. ...
cyrusgb's user avatar
  • 33
1 vote
1 answer
68 views

Abstracting device IO / glue logic in a CPU emulator

In my Motorola 6809 CPU emulator (written in C++14) I'm working on an abstraction to represent the wiring between emulated devices, such as the ports on a 6522 VIA, or the interrupt lines connecting a ...
Alnitak's user avatar
  • 441
4 votes
2 answers
91 views

User defined function call on a stack based interpreter for concatenative language

I would like to receive some advice on how to improve a small concatenative stack-based interpreter, executing a joy-like programming language. It is really minimal, and is in fact a subset of a ...
Foxy's user avatar
  • 143
1 vote
1 answer
435 views

Group items by types: replace nested for loops with reduce

I have a working code that groups items by their type values. The types can be one or multiple, however they are always returned as an array. To illustrate: if an item has types with values ...
Clarity's user avatar
  • 145
9 votes
2 answers
2k views

c++17 compatible std::bind_front alternative

One of the things that has been really exciting me in c++20 is std::bind_front. Using placeholders with std::bind and ...
user233009's user avatar
1 vote
1 answer
939 views

Python implementation of Quicksort using list comprehensions

I wrote an implementation of quicksort that I think is pythonic. I based it off of this common Haskell implementation: ...
Bret Fontecchio's user avatar

15 30 50 per page