You have a line with two endpoints a and b (0 ≤ a < b) on a 1D space. When a or b has a fractional value, you want to round it to an integer.
One way to do this is to round a and b each to its nearest integer, but this has a problem that the length of the rounded range (L) can vary while b - a st...
Yeah I don't see how declarative is just imperative with sprinkles
Unless you mean that when you compile it it all turns into assembly, which is imperative (?), but then you'd be calling the entire language "sprinkles"
> Many languages that apply this style attempt to minimize or eliminate side effects by describing what the program must accomplish in terms of the problem domain, rather than describe how to accomplish it as a sequence of the programming language primitives[2] (the how being left up to the language's implementation). This is in contrast with imperative programming, which implements algorithms in explicit steps.
huh I wonder if I still remember how to code in Python fluently given that it's been like at least a month or two since i've touched it and i've been using basically exclusively JS
@user I consider being able to type something representing "a string with 3 as, an even number of bs, and either 2-3 cs or 4+ ds" and having a regex engine do what I want pretty simple
Hmm, I suppose actually declarative stuff is the opposite of actually imperative stuff, but most of the time I see it used it's just to make semi-abstract half-imperative stuff sound cooler
@RadvylfPrograms I mean, whenever you see any claims about a language being Some Big Word, you should probably just ignore it and try the language yourself
i could probably find some mechanism by which i could make that represent 17/15 but i could also probably make it equal like 20 other numbers so at best i'd get maybe one or two things correct by random guessing
IMO your language is more likely to succeed and be popular if you have community contributions and feedback; popularity is a long game, not a short burst of interest on language reveal followed by nothing
Plus you're more likely to finish because you have other people actively checking your progress and helping you out rather than you potentially procrastinating and pushing back work further and further
ah. moving to c++ would probably be quite painful and if flax makes use of python's infinite integer precision that might be very annoying for you to figure out in c++
Random Pixelated Image Compression
Tags: code-golfgraphical-outputrandomcompressionimage-processing
Given an integer \$n\$, guaranteed to be \$\geq2\$ and a power of 2, we are going to draw multiply boards either side-by-side or below one another, where the first has dimensions of \$n\$ by \$n\$;...
A couple invites N people to their wedding and wants to distribute them on K tables in the best possible way, taking into account their mutual affinity. Assuming that a minimum and a maximum number of guests can sit at the table and that the mutual affinity is known and is expressed with an integ...
A couple invites ***N*** people to their wedding and wants to distribute them on ***K*** tables in the best possible way, taking into account their mutual affinity.
Assuming that a minimum and a maximum number of guests can sit at the table and that the mutual affinity is known and is expressed...
> Otherwise, let n, k, and s be integers such that k ≥ 1, 10k - 1 ≤ s < 10k, đť”˝(s × 10n - k) is x, and k is as small as possible. Note that k is the number of digits in the decimal representation of s, that s is not divisible by 10, and that the least significant digit of s is not necessarily uniquely determined by these criteria.
I saw those, and Code Bots has been pretty similar too, but I mostly meant as a real-time event (get an hour or 2 to make bots, then run them all). Maybe teams.
I do like the idea of a KotH where all submissions are in the same small, easily learned language. It avoids the whole "I'd like to participate but I don't know (JavaScript/Java/Python)" conundrum.
@Romanp For Corewar in particular, from what I've seen of it, there are a lot of established strategies... so with 2 hours to write a bot, I'd say anyone with prior experience would trounce the rest of us.
Would probably need a way to interact better with an opponent, but seems pretty close to working. Something with just one or two functions might do it.
So it turns out QBasic uses call-by-reference--and not the kind modern languages do, where you can only modify mutable values passed to a function. We're talking full "change the parameter in any way you want" call-by-reference.
FUNCTION TestFn(n)
n = n + 1
TestFn = n * n
END FUNCTION
a = 4
b = TestFn(a)
PRINT b ' Prints 25, as you'd expect
PRINT a ' Prints 5
Now that I've run into it again, I do vaguely remember knowing this previously, because when I learned other languages I was surprised they didn't work that way. But now that I'm used to other languages, it's a royal pain to deal with QBasic.
Basically had to create separate copies of all the parameters of one function because I wanted to mutate them in a loop but definitely didn't want the arguments to the function call to be updated.
I guess it can be useful if you're expecting it. Might actually simplify my parser logic.
Finishing rSN and Y'know what's fun about writing an interpreter for a practical language in another high-level practical language...you don't need to garbage collect anything because the language you're writing the interpreter in handles that lol
@RadvylfPrograms if you need a more than 50-character regex to figure out whether or not something is a boolean literal you are doing things incredibly wrong
Hey, as long as it works for you, it has a reason to exist. If too many other people like it, tho, we might have a problem. These sorts of idiosyncratic languages sometimes catch on, and then the rest of the world has to deal with them. ;)