« first day (4594 days earlier)      last day (546 days later) » 

01:00
Sandbox posts last active a week ago: Exponential Replicator Quine
 
1 hour later…
02:19
0
Q: Calculate the Distance to a Line Segment

ATacoThe Challenge Given two vertexes and a point calculate the distance to the line segment defined by those points. This can be calculated with the following psudocode def dist(point, v1, v2): direction := normalize(v2-v1) distance := length(v2-v1) difference := point -...

 
6 hours later…
08:20
I don't think this is rude:
in Petəíŕd's Den, 14 hours ago, by Utility Bot
@TheEmptyStringPhotographer I am actively supporting the Ukrainians in the war.
 
1 hour later…
09:43
if I add a bounty to get more answers for a code-golf question, who do I give the bounty to in the end?
Is there an existing challenge for distance between a point and a full line?
Solved that one by accident instead of a line segment
@mousetail you're not the only one
Anyway if anyone cares: lambda a,b,c:(A:=abs(a-c),C:=abs(a-b),(A*A-((A*A-abs(b-c)**2+C*C)/C/2)**2)**0.5)[2]
10:36
@mousetail that is cool
10
Q: Find a string in the middle

SimdGiven two strings \$A\$ and \$B\$ with edit (Levenshtein) distance \$x\$, find a third string with edit distance \$a\$ to \$A\$ and edit distance \$b\$ to \$B\$ so that \$a+b=x\$ and \$a=int(x/2)\$ (that is half of \$x\$ rounded down to the nearest integer). The input is the two strings \$A\$ and...

in python how can I make all strings of length 10 with a specified number of As, Bs, Cs and Ds? Say 4 As, 2 Bs, 3 Cs and 1 D
is there an itertools method for that?
I think itertools permutations does it
11:07
Yep, permutations(4*"A"+2*"B"+3*"C"+1*"D")
11:19
Won't that generate some combinations twice?
 
1 hour later…
12:45
0
Q: Compile TailwindCSS to CSS

noodle manTailwindCSS is a utility that lets one write CSS code using only HTML classes, which are then converted to CSS code with the Tailwind compiler. Ordinarily, one would write CSS in a separate file from the HTML, and reference named classes: <!-- without Tailwind --> <p class="crazy-monologue">Crazy...

13:31
Peteird thinks this will get me banned, will it?
in ­Trash, 3 mins ago, by Utility Bot
@PetəíŕdTheLinuxWizard I am actively supporting the Ukrainians in the war.
I want to make my own regex, matching semantics will be the same but more complex replacement logic
13:58
@TheEmptyStringPhotographer I just read the convo, and no
Some syntax like this maybe:
(a/b) or (a/*b) Replace any instance of A with B
(a/!b) Ensure at least one instance of A exists, replace just one
(a/+b) Ensure at least one instance of A exists, replace all
(a/?b) Replace up to one instance of with B

(a/$1) Re-use the existing substitution $1
(a/b/c/d) Apply multiple substitutions
Then you can recursively use more substitutions in the "b" section of a replacement
@TheEmptyStringPhotographer whistles innocently
@TheEmptyStringPhotographer thanks for promoting my r... wait...
@Seggan well nvm peteird changed the room description to ban politics after that.
@TheEmptyStringPhotographer I don't want flags in my room. Don't be offended so easy. ;)
14:21
0
Q: Help getting list of tuples to Named Tuple for plotting

skinny_dreamerI finally give..I am just learning python and unsure of how to make my code work. The goal I am trying to achieve is to have my function Return a list of 2-element namedtuple (word, count). I would like to get the values later in another function to plot them in a bar chart. My word list is set u...

14:41
@PetəíŕdTheLinuxWizard Note that may be interpreted as slightly rude, specifically the "Don't get offended so easily" part.
@TheEmptyStringPhotographer Sorry if it seemed rude to you.
@PetəíŕdTheLinuxWizard It's ok, I'm just giving a warning.
> Quote to remember: If you do not do mistakes at all, it means you are a bad learner.
@TheEmptyStringPhotographer yeah :)
If you make a mistake on purpose, is it still a mistake?
Oh interesting, do VTC flags count toward the number shown on the review task?
I just got a task that showed it had 5 close votes already, but there were only 3
14:49
> an act or judgement that is misguided or wrong.
maybe
@mousetail I'd say no
you did what you intended to do :p
15:08
What if you do something you should, and you mistake it as a mistake?
15:27
If you need to make mistakes to learn, but can't intentionally make mistakes, is it impossible to try to learn something?
@mousetail No, because when you try to learn something, you accidentally make mistakes.
That would make the mistakes intentional though, since they required to hit your goal
@mousetail But when you try to learn something, you try not to make mistakes, making you make mistakes.
Then you wouldn't be able to learn, which would itself be a mistake
@mousetail So then you would be able to learn because you made a mistake.
16:12
posted on August 28, 2023 by trichoplax‭

Suggest a word from a word list, given a string. Motivation Imagine typing a word one letter at a time, and seeing a suggested word after each letter is typed. At first the sug...

CMC: Output the power of ten larger than the input. 5 => 10, 62 => 100, 538 => 1000, 1234 => 10000
@noodleman did you mean the smallest power of 10 larger than the input?
16:42
@TheEmptyStringPhotographer yes
@TheEmptyStringPhotographer Regarding your recent comments on the CSS question, if your answer is extremely trivial because you've abused some unstated loophole (or a stated one for that matter), then while it may not technically be an invalid answer, it's an extremely boring and unlikeable answer that is going to be downvoted. In the end, it's not smart or fun to answer against the spirit of a challenge
you've been warned about this a lot on previous answers, but i guess it needs to be explicitly stated
@noodleman Assuming the input is a positive integer, Pip, 4 bytes: EE#a
1. You don't need mistakes to learn
2. Just because you're intentionally trying to do things that you will likely make mistakes on, doesn't mean you're intentionally trying to make those mistakes (it makes intuitive sense that intentionally doing something wrong wouldn't be how you learn)
@noodleman Thunno 2, 2 bytes: le (10**length)
17:34
@JoKing Note that it was a comment, not an answer.
17:47
God I hate Tokio's error handling
It returns errors from every function using a single I/O error enum
And there's no documentation/specification for which functions can return what variants of it or what they mean in certain contexts
It's basically just a binary condition "there's an error" unless you want to read the code and hope nothing ever changes
Holy moly, I forgot this place existed!. Could you guys take a look at my recently added test cases for my sandbox proposal? codegolf.meta.stackexchange.com/a/25966/78039
I'm not sure enough about the big test cases, or if there is another tricky test case I should add
welcome back(?)
I don't recognize you, so if you've been here before it must've been prior to my joining
same, but I haven't been here long
anyway, lgtm
@Ginger You can tell they've been here before because they have 166 posts in here and 166 > 2 :p
I would just say that it would be better if the test cases weren't wrapped in f( ), but obviously that's your choice
17:54
@Ginger I was kind of active before covid, then I basically quit programming xD
(helpful tip: someone's number of posts in a room is in the title text of it in their rooms list when you click their name)
Wait how tf do I have 587
I've literally been here a few months
I have over 64k :p
28 secs ago, by The Thonnu
I've literally been here a few months
:p
I mean I haven...IT'S BEEN 5 YEARS?
17:56
lol
@RydwolfPrograms oh right lol
> 23520 posts total
that is... way more than I expected
@RydwolfPrograms hasn't even been a year on this site for me :p
And I only discovered TNB in like March
that's 35% of Rydwolf's total, and I've only been here for a year and a half(ish)
it would appear that I too have caught Can't-Shut-Up Disease :b
It's infectious :p
@LuisfelipeDejesusMunoz Great that you are back
18:00
okay what happened to my pronoun assistant
he/himwolf programs
Such masculine
@RydwolfPrograms for about a tenth of a second I thought you were referring to a person
@mousetail glad to be back =D this place has made me a better dev overall hahahaha
always something new to learn here
"yeah this is my pronoun assistant, she follows me around and corrects me if I misgender someone"
It's made me significantly worse
@Ginger Nah mine just hands me little slips of paper with pronouns on them
18:02
I got into apple last year thanks to some answers here, most of the people here is very clever and have such creatives ideas all the time
@mousetail I wasted six months of my life creating two completely useless programming languages because of this site :p
18:22
@mousetail Really? How's that?
My first instinct is to write every function as a series of array_map and array_filter only to realize later that the functional array functionality of PHP is too limited to really do everything in an actually clean and consise way so it turns into a unreadable mess
That seems more like a language-switching problem
Yea maybe it's just I refuse to write PHP in a PHP way
19:15
@mousetail im late but if youre reworking replacement logic: please allow to modify the replacement string before the actual replacement occurs. in js x.replace(/(\d+)/,parseInt("$1")+1) will replace a number with the string "NaN" because it is parsing "$1" rather than group 1 of the regex match
when what it would do in an ideal world is replace a number in a string with one more than that number
Well of course that won't work
Yea so basically you can infinitely apply further replacements on the replacement string or it's part. There are no numbers so you can't increment it
You're passing in an expression, not a string/function
no i mean i Know why it Doesnt work
but it would be Excellent if it Did work
do you understand :P
In python you can pass a function as a second argument to re.sub to get that behavior
19:18
:D
time to learn pythies ig
... you realise you could go x.replace(/(\d+)/,(_,z)=>parseInt(z)+1)
no i dont :o
but now i does :-)
thanks lol
this changes everything... i will become more powerful
unrelated though:
in a challenge where you need to, for example, do something based on "halves" of a list, what is generally preferred? an even length list so that you could split it into obvious equal halves, or an odd length list, so that there is a clear "middle" element?
i personally just hate having to handle both even and odd length things if it makes such a huge difference, so im trying to just use one for a challenge idea im working on
Depends on if the middle element is important
fair, in my thing it isnt, im comparing the left half to the right half. the middle element wouldnt factor in at all
Then I'd prefer an even length
But can you just pass 2 lists as seperate arguments?
19:27
no, because of the nature of the challenge
@thejonymyster Pip works the same way: ATO
i can sum it up here but im gonna write up the spec to sandbox today anyway so idk if thatd be redundant
@DLosc yet another reason for me to keep learning pip :P
also classic example choice lol
I like to play the hits sometimes ^_^
19:45
@thejonymyster IIRC Pip was one of the first golflangs, if not the first, to add regex support. It could be better (particularly if it were based on a better regex flavor than Python's), but I'm still pretty happy with it.
 
1 hour later…
21:14
0
Q: Is it an Element?

tuskiomiall. I hope this finds you well. There are 118 elements on the Periodic table at the moment, each one corresponds to the number of protons in an atom's nuclei. Each element also has a 'symbol'. Hydrogen has 'H', Helium has 'He' and so on. I want to know about these! Challenge: Given 1 string as i...

@DLosc Retina isn't a golflang?
well, I figured out why Charcoal's ast processor is pathological
Was it abandoned as a child?
each term is processed to a list, of which the first is usually the name of the term and the rest of the list is the arguments
however, for some terms, such as "expressions", they are parsed recursively, although conceptually they're lists, so the processor wants to flatten the list
unfortunately for the pathological cases it calls itself recursively on the rest of the list twice
worse still, for the top level program, the string it takes such care of to call itself recursively to obtain instead of just hardcoding because it will always be the same is itself never used
@pxeger Would you mind updating Charcoal on ATO to ef9537316dadf7e715829970616852a3d269fdf2?
not to interrupt but dont you hate when you have a cool challenge idea but then you realize theres a way simpler challenge in there which makes sense and is simple and is also good
its like. Agh i know the simpler challenge is probably "better" but Let me cook(,) brain
21:59
0
A: Sandbox for Proposed Challenges

thejonymysterOrder by Earliest Lower Digit Given two strings of digits, determine which string, if any, has the earliest digit which is lower than the other string's digit at the same index. Examples Given inputs 12345000 and 1233999999, the second string would have the earliest lower digit. 12345000 12339999...

i caved and did the simpler challenge idea T.T
@Simd general practice is to give it to your favourite of the answers that were posted between when you posted the bounty and when the bounty expired; the general rule seems to be "the person who sets a bounty gets to choose who to award it to"
@SandboxPosts this is a builtin in a lot of languages
including practical languages, e.g. it is a builtin in Perl
basically because it is just "ASCIIbetical order of the stringifications of the numbers"
or, hmm, no, the behaviour for = is different from what the usual builtin does
(generally speaking, "some digit" is considered greater than "no digit" by the builtins, in order to avoid considering two numbers equal that aren't actually equal)
22:15
right thats intentional
it also doesnt match proper alphabetization in that "abc" comes "before" "aa"
though im not sure how builtins compare to that behavior
I understand if it'd just be a trivial modification to the builtin solution, but we generally encourage non builtin solutions as well so it might still be worth posting, though i'll let sandbox votes decide :P

« first day (4594 days earlier)      last day (546 days later) »