CMC: Given a non-negative integer of at most 2^31-1 (2147483647), determine the number of rotations in no particular direction that results in the largest integer. Direction of rotation (left or right) is programmers choice, and may be constant or not.
I'm not even surprised that Vyxal now has a way to have fractional byte encodings, and tbh, it looks more interesting that most other langs with it, but I still wasn't expecting it
I made a range coder for Vyxal to see how well it works and it looks like it decreases length by about 10% on average. https://github.com/AndrovT/Vycoder Here is the code if anyone wants to play around with it.
(and yes, vyx-µ was a thing a while ago, but for some reason it never got incorporated)
(besides, range coding is apparently better than huffman encoding)
> looks more interesting
It's more like packed stax than nibbles
The CMC was just formatted like that for convenience
The actual bit string is 101110100011100010011010001110010001110
CMQ: Say I have a language where programs are bit strings of any length. And say the length of the bit string is important, meaning that padding it to a whole byte is out of the question. Could I use an encoding like a = 0, b = 1, c = 10, d = 11, e = 100, f = 101... up until any arbitrary length to shorten the bit string for code golf answers?
y'all might be interested in the fact that the encoding utility is written in scala, and turned into js for the website via scala.js and bundled as a jar for the offline interpreter
cursed, yes, but the best solution we could think of
@user I've used submodules once but I never had to update it so I can't fully answer it. It was painful to move the submodule from one folder to another though
like the direction of rotation doesn't actually have to be consistent, your program just has to output either the correct number of right rotations or left rotations for any particular input? ooh i'm having a hard time thinking of what kind of solution could make that useful but i'd love to see one
If moving stuff is gonna be painful, best to avoid them, I guess. I try to stay away from Git black magic :P
@Bbrk24 I mean, Gradle supports a TON of languages, doesn't mean it's actually used for them much. Some company out there may be a Java shop that only occasionally makes Swift stuff, so they might prefer to stick with Gradle even for Swift
I bet there's people out there using Make for languages that are nothing like C/C++
@UnrelatedString I'm of the school of thought that where possible, a challenge should remove as many restrictions as possible, to open as many strange solutions as possible.
I think there's been a change to chat that's broken one of the userscripts I use - something about s.data.replace being undefined when I use chat with userscripts keeps coming up in the error console. And it makes firefox start using a whole lot of RAM
On topic: We currently have 21 imgur links that are going to die soon: https://data.stackexchange.com/codegolf/query/1747560/imgur-links-that-are-about-to-go-down
On May 15th 2023, Imgur will implement its new TOS, in which
We will be focused on removing old, unused, and inactive content that is not tied to a user account.
I, and presumably many other users, have uploaded things to Imgur without logging in, and then posted those images to Stack Exchange,...
Nope.
SE runs a corporate version of Imgur, so image persistence is guaranteed.
I also see no valid reason for nudity on SO, so that seems extremely unlikely to have any (negative) effect.
SE is a leading example of top multimedia streamlining for ease of use.
WebP is currently unsupported when attempting to upload an image. It's fast becoming a very common image format because it is superior to other formats in various ways.
If .webp becomes useable on SE it could be a good upgrad...
This challenge requires me to create an anonymous function that given a string in prefix notation, must return the result.
The string can only contain the following operations +, -, *, /, ^ and integers (negative, zero, positive, etc).
I've come to a point where I can't reduce my function any mor...
On topic: We currently have 21 imgur links that are going to die soon: https://data.stackexchange.com/codegolf/query/1747560/imgur-links-that-are-about-to-go-down
2-Cyclic Quine
In this challenge, you have to make a programme that satisfies these properties:
The programme must output another valid programme.
This second programme must output the original programme.
It must obey all the rules of quines (see exception below).
It must not print itself.
This...
As stated on mother meta all imgur images not associated with a account or the "stack.imgur.com" official corporate instance will be deleted on May 15th.
If we don't replace those links before that date, they will be permanently lost. Some questions and answers may lose unessential fluff but many...
- you can omit the return type if the compiler can infer it - you can omit the argument types if the compiler can infer them - you can omit the parens if you omit the argument types - you can use `$0` and `$1` instead of explicitly listing the arguments - you can omit the word `return` in a non-Void closure iff the body is a single expression
@lyxal Okay then, what about let f: (Bool, Int, Int) -> Int = { $0 ? $1 : $2 }
@lyxal That is a subject which has been vehemently debated on the Swift forums. The current consensus is that it’s not something that should be done, and regardless in some cases it would be breaking to add it
reduce(into: []) {
$0 += $1
// appends into the existing reserved capacity,
// only allocating more as needed
}
reduce([]) {
let ans = $0 + $1
// because all three coexist, you have to allocate new memory for ans
// that is where the quadratic performance lies
return ans
}
The other thing is: if you want to discard the first parameter you can say { $1 }. If you want to discard the second parameter, you have to write { x, _ in x }