For some reason, Javascript thought it'd be a good idea to have two replace functions for strings: one that only makes a single replacement and one that replaces all occurrences. It doesn't help that other languages only have a single replace function that usually acts as the latter.
@Lyxal Don't ever use replaceAll. It uses some weird iterator thing internally and only works on a few newer versions of browsers. Just use the g flag to make it a global regex
If it's a fixed string for the first parameter I'd just use a regex, although you can do replaceAll if you don't care about browser compatibility (which none of us do :p)
Note that JS does have a function to encode and decode URIs
@RedwolfPrograms Uh... a school project? At this time of year? At this time of day? In this part of the internet? Localised entirely within your computer?
Write a Brainfuck compiler + decompiler!
Many Brainfuck compilers will convert to a different language instead of compiling directly.
Your job is to write not only a compiler in language X which compiles Brainfuck to language X, but also a decompiler which takes code compiled with said compiler a...
@Razetime I have no idea how yours works and how to make it work (I can't read Husk), but here's an alternate solution that works for at least 5 elements. Good luck!
Here's a 19 byte version, actually, but it uses that ugly lambda :(.
@Razetime Btw, your current code infers and is pretty fast, I got the first 10 elements in about 22 seconds; the only problem is that the last few elements are off. Maybe there's a rounding error somewhere?
@RedwolfPrograms What was wrong with 1.0? It looks fine to me.
Print a 3D shape
write a program/function to print this cube (or whatever it is) in different sizes:
¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L
//¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L
////¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L
//////¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L
////////¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L¶L
//////////...
Is it a vampire number?
Repost and improvement of this challenge from 2011
A vampire number is a positive integer \$v\$ with an even number of digits that can be split into 2 smaller integers \$x, y\$ consisting of the digits of \$v\$ such that \$v = xy\$. For example:
$$1260 = 21 \times 60$$
so ...
@user I'm not sure what's the algorithm they tried to implement there... It seems to be working, but it becomes extremely slow after a dozen elements or so.
@Razetime we can discuss about this and ḟ in the Husk chat as soon as it gets unfrozen :)
@Leo The slowness is to be expected - mine and other people's algorithms timed out after just 5 elements. The issue seems to be some kind of floating point error, the last couple terms seem to be off, maybe because of the square rooting/unsquarerooting.