Questions tagged [reinventing-the-wheel]

For when you know you are reinventing the wheel, but are doing it anyways. Questions with this tag involve code that is already fully implemented (such as from a library).

Filter by
Sorted by
Tagged with
4
votes
2answers
540 views

Javascript Tree Class

I got caught in the trap of implementing my own data structure. I've created a very general tree structure, where each node gets one parent, some children, and holds a value. I'm mostly looking for ...
6
votes
1answer
111 views

Generate music notes by specified key and scale

As a follow-up on isosceles' question, I have created a small API to generate the notes of a scale given the pitch class set and key note. I've added the reinventhing-the-wheel tag because I know ...
6
votes
2answers
1k views

Reimplementation of min() in Python

I'm reimplementing the min() function as an exercise (EDIT: not all the functionality of the python std library function, just the minimum of a list of numbers). ...
5
votes
2answers
160 views

Code Challenge: basic arithmic operations using only incrementation operator

Challenge Write a function that takes 2 integer operands left and right (both >= 0) and evaluates one of the following ...
6
votes
1answer
328 views

A standard-conforming C++17 std::optional implementation

I took quite some time to implement a fully standard-conforming std::optional in C++17. It turns out more sophisticated than I initially thought. My code is just ...
3
votes
0answers
158 views

Circular doubly linked list implementation in Cython

This is a follow-up from my previous question. In summary, I am trying to implement a BVH module with Cython and need a way to keep track of the volumes during the construction of the hierarchy. I ...
2
votes
1answer
321 views

Simple, flexible, and thread-safe key/value memory cache

MemoryCache.cs ...
5
votes
1answer
552 views

All-Python implementation of n-dimensional convolution

To better understand how discrete finite convolution works (read educational purposes) I wrote an all-python implementation of the convolution function. The idea was for it to give the same output as <...
1
vote
0answers
46 views

Determine the hyper-parameters of an Approximate Bayesian computation

I created my own Approximate Bayesian computation algorithm in Python 3 and I try to find the best hyper-parameters for it but it is really slow. This question is not about the math involved in it. ...
8
votes
4answers
2k views

Very basic singly linked list

Here is implementation for singly linkedlist. Any suggestions are most welcome ...
6
votes
2answers
90 views

Would log4j be more efficient to utilize than the logger I implemented (Code Below)?

I recently made a logger program implementation in my game engine. Which logs any thing that I send it in either a file or the System.out printstream. I use it like this: ...
2
votes
2answers
869 views

Staircase challenge - Python

Your task is to print all unique ways to climb a staircase of length n where, from each step, you can take steps of size x where ...
1
vote
1answer
70 views

Boolean class using shared referenced memory

To improve my knowledge I am trying to make a bool class from scratch, or derivative of. I am using MinGW g++11 compiler on a Windows 7 laptop. ...
2
votes
2answers
71 views

Implementation of enumerate

I'm trying to implement the enumerate built-in using iterators. So far it works but for unordered objects, such as sets or dictionaries, I'm not sure if this implementation is considered valid, ...
1
vote
1answer
65 views

shared_ptr alternative with no dependencies

An alternative to shared_ptr to minimize compile time. Intrusive. Reference count changes are not thread safe. (...
3
votes
1answer
139 views

std::function alternative with no dependencies

An alternative to std::function for when compile time is more important than runtime performance. Doesn't pull in any headers. (...
6
votes
1answer
185 views

STL-like vector implemention in C++

I attempt to write a STL-like vector, mostly to figure out how it works. I wonder which parts look weird or what I made stupid. Any kind of comment is appreciated: alloc.hpp ...
4
votes
2answers
124 views

Min Heap implementation [C++]

I've never had my C++ code reviewed before so I'd appreciate any feedback. Although my main focus was not on the implementation of the algorithm itself, any suggestions regarding improving it would be ...
8
votes
3answers
1k views

Find website URLs that begin with http:// or https://

This is a problem from Automate the Boring Stuff from "Pattern Matching with Regular Expression". I am a beginner in Python and the purpose of this program is to match urls which start with ...
1
vote
1answer
73 views

JQuery Selector in Vanilla JS

I've decided to reproduce the JQuery selector - specifically for finding elements by class name, ID, and tag So for example the tests could be written like ...
3
votes
1answer
73 views
3
votes
2answers
126 views

codekata: Binary search on an int array

I'm following Karate Chop kata for a binary search. I really wanted to avoid built in functionality within the language. I'm pretty new to C# so any recommendations is greatly appreciated. Spec: ...
5
votes
2answers
6k views

C++ Arraylist Implementation

I am a new C++ developer who, coming from Java, am having issues in understanding some of C++'s key memory management features. Below is my attempt at an ArrayList implementation and I would really ...
2
votes
2answers
198 views

Miller-Rabin Large Prime Generator in Rust

I implemented the Miller-Rabin prime test in Rust and made a program to generate large primes. I have also implemented the same program in C and Haskell and the Rust version is the slowest. I am ...
3
votes
1answer
77 views

C function to fully consume a Python iterator

I was reading into the proper way to consume an iterator on this question as well as here and I notices there is no actual proper function for this that clearly explains itself. Using: ...
6
votes
2answers
152 views

Compact command line argument parser : Revisited

This question is a follow up to my previous one which can be found here. The user dfhwze suggested me to look into compiler construction and recommended me to write a lexer and a parser that would ...
2
votes
0answers
93 views

Parallel Miller-Rabin Prime Test in Haskell

I implemented a prime number finder using the Miller-Rabin prime test in Haskell and it seems to be working. You enter a number and it finds the next prime following that number. I also tried to make ...
2
votes
1answer
529 views

Employee database

To keep in practice with good techniques of java programming, I've decided to write a database. All it does it stores employees, allows users that are logged in to get/set employees, and has a login ...
2
votes
1answer
265 views

Compact command line argument parser

So, I decided to write my own little command line argument parser for various other projects I work on. I am aware that there are many good command line parser libraries, but I did wrote my own anyway ...
4
votes
2answers
2k views

Regex version of strip() - Ch. 7 Automate the Boring Stuff

Here is a practice exercise — Regex version of strip() \$-\$ Write a function that takes a string and does the same thing as the ...
3
votes
0answers
175 views

Strongly Connected component algorithm implementation(Python)

My goal is to implement Strongly Connected Components algorithm using python. I have splitted up my code on 3 parts: Data Load: ...
4
votes
2answers
139 views

Obfuscation of email and phone using JavaScript

I'm creating a new website, so I am thinking about how to protect my email address and phone number against crawlers, I actually mean email harvesters (most of which I suppose don't have JavaScript ...
4
votes
2answers
158 views

Python logging-module that writes to both the console and a file

I've created a small module with a function plog() that allows to easily print to both a log file and the console. It also creates a directory "log" at the location ...
28
votes
5answers
7k views

C++ logging library

I am creating a logging library in C++, and I wanted your opinion on code quality and performance within some methods. You may ask why yet another logger - the answer is simple. This logging library ...
7
votes
1answer
449 views

A C++17 std::function implementation

Some time ago I implemented dynamic_array and posted it on Code Review. It used std::function internally for type erasure. This ...
4
votes
0answers
206 views

C++17 implementation of std::invoke

C++17 introduces std::invoke which calls the exposition-only INVOKE. Here is an implementation. This isn't a large amount of ...
4
votes
0answers
93 views

SHA256 implemented in Rust

I just finished making an implementation of a SHA256 hashing function (https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) in Rust and I was looking for some feedback. As far as I can tell it ...
3
votes
0answers
262 views

A fixed-size dynamic array

Background I implemented the historic std::dynarray according to the specification under the name dynamic_array in C++17. ...
6
votes
1answer
566 views

Fast prime generator

I wanted to test my performance optimizing skills, and so wanted to find how fast I could get the first \$n\$ prime numbers. I limited myself to only the standard library, as I'm sure ...
12
votes
2answers
5k views

C++17 thread pool

I've implemented a thread pool in C++17. This is not backwards compatible with C++14, due to the usage of std::invoke_result, which is new to C++17. The focus of ...
4
votes
0answers
137 views

Java multithreading many readers one writer implementations

I have a shared data object with writer threads and reader threads. Number of threads can read from the shared data at the same time (in the code getmethod), and ...
2
votes
1answer
298 views

Converting hex strings to byte arrays and back to hex strings in Java

Here is my attempt at converting hex strings to byte arrays and converting byte arrays to hex strings: net.coderodde.util.ByteStringConverter ...
10
votes
3answers
337 views

C++20 standard compatible vector

I decided to write my own vector class template for learning purposes. My main goal was a correct interpretation of C++20 standard (as of n4810). I took some liberties and decided to use concepts ...
6
votes
1answer
547 views

Calculate the day when Date is given as input using the Doomsday algorithm

Was too bored in holidays...here's a code which finds the day of the week using the algorithm in this video. Please give a logical date in the correct format cause I didn't account for improper inputs ...
6
votes
1answer
172 views

C++17 Either implementation for error handling [closed]

This is a C++17 Either implementation for error handling. First intent is I want to improve myself. Second intent is I want to create a more expressive solution than variant for exception free error ...
5
votes
1answer
339 views

C++17 allocator_traits implementation

Inspired by my earlier question C++17 pointer_traits implementation, I re-implemented allocator_traits under the name ...
7
votes
0answers
130 views

C++17 pointer_traits implementation

pointer_traits is a lightweight trait that provides a uniform interface to builtin pointers and user-defined fancy pointers. That said, things like ...
5
votes
1answer
553 views

My unique_ptr implementation

This is my simple unique_ptr implementation. Anything that could be improved upon or should be added? ...
1
vote
1answer
49 views

Reimplementation of call() method in JavaScript

I was try to reimplement the native call method in JavaScript. Here we need to handle the object which we pass in the call function and additional params. I handle ...
4
votes
2answers
132 views

Defining a class that behaves exactly like an `int` [closed]

This is an exercise to create a class that behaves exactly like an int. Questions Am I missing anything? Or did I going about this about this the wrong way? Is ...

1 2 3
4
5
17