The fun part here is how the 3n+1 function is computed: by generating the infinite list [0, 4, 1, 10, 2, 16, ...] and indexing into it. This was the shortest method I found, both in tokens and in bytes.
(though it would be shorter if I implemented an if modifier)
Based on the observation that the values of the Collatz function are two different arithmetic sequences interleaved (one for the odd numbers, one for the even numbers)
Oh, yeah. I guess null is kind of unusual in golfing languages
@DialFrost I don't, but I get bored of CGCC all the time, and I've never met anyone here who doesn't. Answering on other sites for a while seems like a pretty reasonable response to that sort of boredom.
I know it's a bit of a pink elephant thing to say, but IMO it's not worth worrying about losing interest in something in the future. Quite often doing that makes me lose interest in that thing now, at least temporarily,
maybe since I feel an urge to make the (not really) inevitable event as painless as possible. In reality, just do what you enjoy now (and of course, what allows you to enjoy things in the future), and if you lose interest in a year, the nice thing is that you probably won't be interested in being interested.
@DialFrost Only from the perspective of now-you, who is interested in being interested
When I'm interested in something, that's like, a vulnerability. I'm tempted to think of the possibility of losing interest as a threat to what I enjoy now, when the point is that I won't enjoy it when I lose interest. It's this weird circular thing.
@RadvylfPrograms wow this looks so weird since on my screen lowercase regular s is between the height of monospace capital S and monospace lowercase letters
So, for the shorispo library (what catstruct and any other golfing languages I make in the next few years will use), I think I've decided on a number type
Arbytrary precision floats
Now Radvylf, you might say, that doesn't make sense.
And it doesn't (well it does but in the wrong way). Float here doesn't refer to how the numbers are stored, but instead how they behave in certain corner cases.
Despite having arbotrary precision rational/real/complex support, it will also have signed zero and infinity
Since I find them really really elegant, and they could possibly be useful in some really rare cases
so the next sequence for the oeis thingy is some erroneous sequence: oeis.org/A001984. yall think its fine if the next sequence is the correct version instead: oeis.org/A045535
> Hardcoding is only allowed if the sequence is finite. Please note that the answer that prompted this (#40) is the exception to the rule. A few answers early in the chain hardcode, but these can be ignored, as there is no good in deleting the chain up to, say, #100.
ig the wrong sequence is finite lol
but it feels wrong
like the property its based on can be used to extend to infinite sequence
@thejonymyster actually, yes. if theres no discernible pattern, i would be ok with hardcoding. but because theres a discernible pattern (many of the numbers are actually correct except for maybe a few), its a little more gray for me
@thejonymyster well thats not really the problem, its more like u can have some code output the sequence based on the property but then hardcode the wrong values, but then why not just use the correct sequence if u gonna do that anyways?
Consider the following setup. An evil wizard has ten opaque boxes in front of him. Hidden from you, he chooses a random number of coins \$x \in \{1 \dots 10\}\$ and spreads them uniformly at random in the boxes. That is, there should be equal probability of assignment of coins to boxes from all...
Nice verb there, in the title.
Write a program that given an input string, will "elasticize" this string and output the result. Elasticizing a string is done as follows:
The first character is shown once.
The second character is shown twice.
The third character is shown thrice,
and so on.
As ...
I am trying to find a nice sed solution to the "elasticize strings" problem above, and this is my attempt so far, which almost does what we want except for the unwanted newlines. I need some way to P without including a newline, or perhaps a wholly new strategy. Any ideas? (ofc I could remove the newlines with a 2nd run of sed, but want a solution with a single run)
Ahhh, so the parsing problems I was having were because it was a monadic chain, and yours makes it a dyadic chain instead (but still works fine if you only give it one argument?)
the number of arguments passed to the program (or the adicity it's invoked with with ¢ÇçÑñ£Ŀŀ) determines the adicity of the meta-chain (the "furlong"), and the first chain in the meta-chain inherits that adicity, but after that it's all determined by chain separators then evaluated according to chain rules in the meta-chain
I'm just disappointed that ƙ creates a dyad in the first place. I think I'd prefer to have a dyadic atom that does what ¹ƙ does, and make ƙ a monadic quick that does what ƙ` does.
CMQ: what sort of strategies exist to generate fibonacci numbers? im trying to do it without explicit looping / not just the closed form "floor f(phi)", but i have mapping, reduce, range, and some other stuff
i cant just list explicitly everything i have because im still designing the lang and im not sure what i need; this is part of me deciding what to add lol
also bizarre that it literally only accepts monads; as marginal as the mapping over groups functionality is i think i actually have had a few times i've wanted to do so with access to the group's key :P
@thejonymyster If you implement your language in a language that handles infinite lists easily, implementing infinite lists is easy. Otherwise, not as easy.
might be too hard for me atm, i might just trudge onward without cool fib and just accept that this will be more of an experiment than a useful lang haha
@UnrelatedString I think in this case, you need two numbers, because you're generating the rest of the list by adding two different entries together. So you need to have two different entries to start with.
i actually got most of the 5-byters you did after you bumped the challenge with bqn but trying to use ƙ only got me to ¹ƙṢFɗ@ƑJ which doesn't even work lmao
@DLosc can't entirely tell what you mean but yeah; x dÞ y sorts the elements e of x by e d y if that's coherent
Is there any golfing language with a one-byte "is sorted" builtin? Seems like it's 2 bytes everywhere I look: ṢƑ in Jelly, ÞṠ in Vyxal, ≤₁ in Brachylog...
(and $<= in Pip, although if it were strictly increasing you could do $< in 2 bytes)
There's nothing quite like spending half an hour writing and rewriting 12 lines of Haskell, tying your brain in knots to figure out how the types fit together, and finally at the end of all that clicking Run and getting no compile errors on the first try. :D
Well, okay, mostly works. The part that involved the brain-knotting works. There's a small bug in a less-involved part that should (heh heh) be easy to fix.
In computing, a fork bomb (also called rabbit virus or wabbit) is a denial-of-service attack wherein a process continually replicates itself to deplete available system resources, slowing down or crashing the system due to resource starvation.
== History ==
Around 1978, an early variant of a fork bomb called wabbit was reported to run on a System/360. It may have descended from a similar attack called RABBITS reported from 1969 on a Burroughs 5500 at the University of Washington.
== Implementation ==
Fork bombs operate both by consuming CPU time in the process of forking, and by saturating the...