« first day (4435 days earlier)      last day (401 days later) » 

12:05 AM
0
Q: Bash on *nix: bi-directional sorted mapping with adding single key

Mika Feiler Write code in most recent Bash 4, may use POSIX utilities or coreutils. You can reserve up to 20 global variable names. Neither kind A nor kind B string values contain newlines or null characters. Given is a global indexed array of valid kind A string values, that may have elements disappear fro...

 
12:48 AM
@UnrelatedString what engine tho
 
probably one that doesn't take too long to run :P
 
also the evaluation could vary with time
@UnrelatedString i think stockfish is pretty much default
 
1:00 AM
Sandbox posts last active a week ago: My prefix is food, my suffix is rude
 
oml I found APL in a theory of computing textbook
> APL is not one of the major programming languages in use today
oof
 
you're either showing something cursed from one of your projects (or CGR) or you're pointing out that I have bad programming practices :p
 
why you?
(this is GGR)
 
@Seggan I swear I have something like that somewhere in vyxal 3
nvm it's only a list of String Int pairs
but at some stage I was probably doing something like that
 
1:11 AM
@lyxal link or it didn't happen
 
Chapter 1 of Automata, Computability and Complexity. Theory and Applications by Elaine Rich
9th edition
 
I WANT A [Hyperlink Blocked] NOT A [Peer-Reviewed] [Rip People Off]!
 
Well I can't give you a link
Not legally at least
 
oOoooh Ginger tryna break the law
 
YAR HAR FIDDLE DEE DEE BEING A PIRATE IS ALRIGHT TO BE
 
1:15 AM
Worms have been sent to your location
 
ooh yummy
 
@lyxal why not
ah you paid?
 
@Ginger for legal reasons I do not condone piracy or using websites like genesis library or whatever it's called for finding books like that
 
@lyxal me neither, but I wanted to make the joke :p
 
@Ginger I know but that's also what uni workshop leaders say when they talk about textbooks
 
1:18 AM
YAR HAR FIDDLE DEE DEE
 
IMO scientific articles and to a slightly lesser degree, textbooks are like, perfectly valid to pirate. And I'm generally against piracy.
Knowledge should be free
And the publishing industry deserves it
 
BEING A PIRATE IS ALRIGHT TO BE
 
Okay I think I've finished updating the Trilangle online interpreter links
 
@RydwolfPrograms but how should the people who collate the knowledge be compensated?
I don't disagree with you, I just think it's an unfortunate dilemma
 
Scientists don't get compensated by journals anyway, and textbook authors can profit plenty from ones bought by schools and stuff
 
1:24 AM
But if knowledge is free, why would schools pay?
 
For scientific papers there's literally no moral dilemma I can find. For textbooks it still exists, but not to much of a degree
@lyxal Same reason an enterprise customer pays 10× what I do for SSDs
 
One place I'm active has an interesting policy: they generally allow sharing papers etc since the vast majority (if not all) of the money goes to the publisher, and none to the authors. However, some books they don't allow because the author is making money from the sales
 
They have the money, they want to do things "the right way", and they care about having the most up-to-date option with the best customer support and stuff
Less the last two with ✨knowledge✨ but still
 
@RydwolfPrograms That's a little different though. Hardware still costs money. But if textbooks as PDFs are free, why would schools pay for licenced copies?
 
Because governments, companies, and schools are goody two shoes
They could get free PDFs now if they wanted to
They still do things legit because that's just what they do
 
1:27 AM
But we're assuming that textbook PDFs are free legally
 
Well it kinda falls apart once it's legal
 
That's what I was saying
 
IMO it should stay ""illegal"" because what we have now is a pretty nice system
 
In one of my classes, the former professor wrote the textbook, so the current professor has a legal PDF, and he just uploaded it for all of us to just have
 
so im writing an assembler rn for CGR
and i cant imagine writing the first assemblers in machine code
 
1:38 AM
No need, write it in a second language, then write it in the assembly.
 
my assembler is 101 lines of a modern programming language. if that, then how much machine code did it take for their assemblers?
@ATaco except they didnt have second languages?
 
You can write an assembler in any language, ideally something close to the target
Then, if you wish, rewrite it in the assembly.
 
...the point is there weren't any languages yet
 
^
 
Oooooh, Forgive me, Misunderstood.
 
1:40 AM
they wrote everything in machine code, until someone decided that memorizing numbers was too hard
 
Worth noting they'd write them in assembly then hand-compile them tho
 
Writing the first assemblers would've sucked. But they were also doing it with Punchcards.
 
Not just sit down and vomit some binary
 
@RydwolfPrograms oh yeah true
still, hand compilation mustve been tedious
logic error: did you mis-hand-compile it or did you actually mess up the program?
 
bruuuh guys i just realized that piet doesnt have a < operator, so i cant do (a>b)-(a<b) like the other answers... theres no absolute value either. what are some alternatives???
checking each manually seems like a pain too
 
1:49 AM
Trilangle's only branch instruction is "branch if negative", so I just did if isNegative(x) { print(-1) } elif isNegative(x - 1) { print(0) } else { print(1) }
I don't know what Piet's instruction set looks like
 
@Bbrk24 that looks like sign, not compare. i assume u did x=a-b?
 
We might be thinking of different questions
 
@AidenChow Piet does have >
so you just do (a>b) - (b>a)
 
@Bubbler oh yea
that makes things a whole lot simpler lmfao
 
and I have this
for three-way comparison, I think chainging the leading I to II- in my "sign" is the golfiest at 21 bytes
(if colors work out, didn't check yet)
those rolls are damn heavy
 
1:57 AM
@Bubbler wait what, u mean just adding an inN at the beginning then subtract or what?
dont u have to pad the rows below with black codels if u do that... or am i missing smth here?
 
@AidenChow yes
it's like pushing a folded rubber sheet, so it just adds two more colored pixels on the new rightmost column
 
oh nice, lemme see what a naive vertical structure would give compared with this
i suspect it will come out quite a bit longer
ok well i got 22 bytes
 
2:15 AM
cool
that's super close
 
the two rolls is costing a lot tho
and also i just realized that i have to input in the order b a instead of a b lmfao, is that even allowed
 
well, ask the author lol
 
well im not gonna post the 22 bytes answer anyways lmfao
it would be longer than 22 bytes if order a b is required tho
cuz rn im doing (b>a)-(a>b) instead of (a>b)-(b>a)
 
I was about to say "it's just one swap away" and then realized one swap is like 4 bytes in Piet lol
 
my code for reference in case there are some obvious golfs: piet.bubbler.one/…
 
2:19 AM
Isn't it just one negation away?
Which I have no idea how easy is in Piet
 
no negation in piet
 
0-n..?
 
negation is kinda worse, as you need something like 1 2 - * which is cost 5
 
Ouchy
 
2:20 AM
0 is a bit costly to push in piet as well
 
or 1 ! 2 1 roll - which is 7
 
u can only push positive integers, so u would have to do some form of arithmetic to get 0
becuz rn what im doing is inN dup inN dup then i do 3 2 roll, which puts a b b a on the stack... then greater than on the b a, roll it to the bottom, and do > again, which results in b>a a>b on the stack, minus then gives (b>a)-(a>b)
oh wait maybe i can just roll the top to the bottom at the beginning
then it would be b a a b
same byte count im pretty sure tho
 
yeah you can use 4 1 roll I think?
instead of 3 2 roll
 
@Bubbler yep, exactly what im thinking
ye that works
doesnt really matter anyways cuz its still 22 bytes
4 1 and 3 2 both take up the same amount of bytes lol
 
 
2 hours later…
4:33 AM
@ATaco As the developer of ReRegex, and still actively writing new answers in it, I'm curious... have you run up against the problem of Java having a very buggy regex engine? Of all the engines I've worked with, I've found Java's to be by far the buggiest, and with the hardest to explain bugs. And I tried to write an answer in ReRegex once, but had to scrap my plans, because the bug I ran up against was insurmountable.
Have you ever had to change your method of attack on a problem due to a Java regex bug? Or even had to give up on answering a particular question?
 
@Deadcode Nothing Java Regex Specific, but I don't frequently find myself using the more complex features of it.
 
Answers where a Java regex bug has been exposed: Tralindromes, Fibonacci reversed!, Converge to a number, Do you make me up?
In every case, I've found the bug to persist in the latest version of Java.
 
What's the Bug? Something Conditional related?
I'm pretty sure I also wrote ReRegex in Java 6..? So if it's a new bug it won't be affected.
 
Java doesn't have conditionals. And some of its bugs are pretty basic... like, it just doesn't try all the possibilities, i.e. gives up backtracking far too early.
 
One could also Port ReRegex to a different flavour really easily, considering it's a very simple language.
 
4:50 AM
@ATaco Yep. But then what would be the best way to identify the language in CGCC answers? "# ReRegex (PCRE)" perhaps? Or should it be more explicit, like "# ReRegex (PCRE flavor)" or "# ReRegex (PCRE engine)"?
 
Probably exactly like that, yeah.
 
5:10 AM
Oh yeah, and one more showing a Java bug (except in this case, Boost and Ruby are bugged as well): Determine if all decimal digits are unique
 
 
2 hours later…
6:40 AM
0
Q: Find the linear transformation

Command MasterGiven a set of bit vectors \$A\$ and a binary matrix \$M\$, we can define the set \$MA = \{ Mx : x \in A \}\$, where \$ M x \$ is the result of the matrix multiplication of \$ M \$ by \$ x \$ over \$\mathbb{F}_2\$, the field with two elements. Given the set \$ A \$ and the set \$ M A \$, your tas...

 
 
2 hours later…
8:24 AM
0
A: Sandbox for Proposed Challenges

BjopIt a problem I solved but now I am curious whit what techniques it can be improved. The original language is JAVA but here it doesn't matter. You start with a list of n strings with a length of 7 characters. What is the most efficient algorythm (fastest) to determen the langest substring all the ...

 
 
1 hour later…
9:29 AM
11
Q: SE API multiple-escapes the returned data (at least display names, userlinks, and post content)

Martijn PietersThe Stack Exchange API will, unless you explicitly disable it, apply HTML escapes to certain strings. However, it will apply this transformation multiple times prior responding with the data. This is most easily visible when querying users. For any username containing the letter Ö, such escaping ...

Lol this is dumb
 
9:49 AM
Obviously all html escaping should be implemented as escape until invariant
 
What seems to be happening is:
load data from cache -> escape -> store escaped data in cache
 
Ooh that's a fun little loop that won't lead to any problems
On one hand, I can see where that goes wrong. On the other hand, I kinda feel like I'd have done something stupid like that myself in that situation
 
You could probably create a denial of service attack from this bug, by forcing it to escape and store a exponentially lengthening string
 
It's already crashed smokey as indicated in the answer on that post. It probably could frick up the cache
 
If smokey is on fire, then we have real problems. I guess that would create meta-smoke
6
 
9:54 AM
Congratulations you've won the pun of the day award
 
Who won it yesterday?
 
No one
Because I decided that there weren't any winners
 
 
1 hour later…
10:58 AM
@mousetail lmao
CMQ: Is it okay to provide "bad grammar/formatting" as a reason for a downvote? I know I could edit the question/answer to fix it, but I feel like that should be the author's job so that the meaning doesn't get changed; however, not everyone speaks good English
 
In the sandbox, no. On the main site yes
 
@Ginger depends. If it's just a few typos, then no. And if it's still mostly understandable with the errors, then also no. But if it's a serious issue, then maybe. And even then, only if you're feeling particularly nitpicky and willing to waste one of your votes on grammar/formatting.
 
alright
thabks
 
11:40 AM
@Ginger Also, you can vote for whatever reasons you want
 
12:15 PM
time to go back to screaming at Rabbit
I worry that this project is slowly driving me insane :p
 
I kinda assumed you where always insane
 
^
 
Mad I was... until it worked
holy hell
I fixed the recursive type issue! :D
@Seggan
and it was so simple too: all I did was change the signature of instantiate a bit
abstract fun <T: ResolvedType> instantiate(parentContext: Context): RabbitObject<T>
and that can be overridden and have its types inferred
waiiit
shit
goddammit why can't you just work
fixed it (again) by completely removing the generics and making the signature into abstract fun instantiate(parentContext: Context): RabbitObject<*>
it can just be overridden
 
12:43 PM
What was the old/recursive signature?
 
didn't have one, because I couldn't make it work at all within Kotlin's syntax
 
12:58 PM
okay, we've gone from 31 errors to 10
this is progress
oop it jumped to 23
:|
 
1:36 PM
@Ginger noice
 
2:08 PM
hrm so ive been messing with a certain error in gradle
and i finally fixed it...
by going to the link in the docs offered to me by the error smh
i should learn to use the docs more
@Bbrk24 you said mingw bash doesnt work well with vscode, have you ever considered using WSL?
 
MinGW bash works fine with VS Code, it's gradle that it interacts poorly with
Gradle tries to overwrite text in-place, but I guess MinGW's ioctls are different than gradle expects, because that utterly fails
 
@Bbrk24 ah
 
2:46 PM
me when 30 errors in my file
ok, we've gone from 9+ to 9
@Seggan what exactly is the type property used for in TNodes?
I see it being used for return types, variable types, lots of things
 
3:32 PM
Well I'm dumb
I spent ages waiting for my genetic algorithm to start giving me better results then remembered I hadn't actually implemented the natural selection part yet
 
lmao
@Seggan really what I'm trying to figure out is if my TypedNode's type parameter should be constrained to just ResolvedStructTypes
I think so, but I'm not 100% sure
 
4:06 PM
@Ginger ... for knowing the type of the node?
@RydwolfPrograms ooh genetic algorithms
what for?
 
Color names
 
@Ginger whats the hierarchy of type classes?
@RydwolfPrograms why
how
 
4:36 PM
@Seggan oh boy you're gonna love this :p
@Seggan Type has children UnresolvedType and FunctionType; UnresolvedType has children UnresolvedStructType and UnresolvedFunctionType; ResolvedType has children ResolvedStructType, ResolvedTraitType, and ResolvedFunctionType; ResolvedStructType has children NothingType and NeverType (both singletons) and PrimitiveType; ResolvedFunctionType has child WrappedResolvedFunctionType
I think that's correct
 
@Ginger yeah in that case make it Type as it can take a FunctionType
 
hmm, right
will do once VSCode stops dying
mmm delicious 100% CPU usage on both cores
 
5:05 PM
ok so i finished the assembler for CGR
loadc "Hello, World!"
print
produces
0000: de ad c0 de 03 a6 53 54 52 49 4e 47 a5 4c 4f 41   ......STRING.LOA
0010: 44 43 a5 50 52 49 4e 54 01 00 ad 48 65 6c 6c 6f   DC.PRINT...Hello
0020: 2c 20 57 6f 72 6c 64 21 02 01 00 02               , World!....
label 0
loadc "A"
rprint
jump 0
and i can confirm the generated file works
 
@Seggan you're just encoding the opcodes as plaintext???
 
5:21 PM
yep
due to the extensibility of the vm
 
why?????????
 
dont want id clashes
yesterday, by Seggan
we cant have conflicting byte ids
 
okay fine I guess
still feels jank to me
 
yesterday, by Seggan
ive had to suffer though byte id hell when writing certain minecraft plugins
yesterday, by Seggan
until the parent plugin switched to string ids, much easier
 
FINALLY
ZERO ERRORS IN Type.kt
now on to the next file! :)
 
5:25 PM
@Ginger the strings are only stored once, and referred to by their index in the table, so no unnecessary dupes
the actual code is the last 3 bytes
 
time to fix the 12 errors in Object.kt
also I guess I'm changing the type property of RunnableNode to ResolvedType
mmm I don't know if this is a good idea
@Seggan there are a lot of differences between function objects and struct objects
 
40 mins ago, by Ginger
hmm, right
@Ginger theyre still types
 
function objects don't have fields
although actually I guess that's not a giant issue
because fields are only accessed in one or two places
 
2 mins ago, by Seggan
@Ginger theyre still types
 
5:46 PM
zero errors in Object.kt!
 
noice
 
also, nearly 2k sloc
Rabbit is now officially the biggest project I've ever made
although to be honest the experience of constructing it has been akin to being thrown off a cliff with several crates of parts and building an airplane on the way down
 
6:15 PM
@Seggan advanced Kotlin annotations: @RabbitFunction<PrimitiveNumberType>("+", Visibility.PUBLIC, PrimitiveNumberType::class)
I hate the redundancy here but it's needed in order for everything to work correctly
@Seggan can I have some advice?
I have an issue that I'm not sure how to solve
 
6:42 PM
How should this answer be dealt with?
I guess for one it's invalid since it takes input with a variable
For two it's a copy of several existing answers
For three the source they took it from is MIT licensed
I've pointed out #1 and #2 to them, didn't suggest any action tho
 
@Ginger what
@RydwolfPrograms which requires a license copy
i suggest we delete it
 
Yeah, but the code is so unoriginal and trivial that I don't think it can be feasibly claimed to be copyrighted
 
true
 
7:08 PM
@Seggan so basically all subtypes of ResolvedType have an instantiate method which creates a new instance of them; I want to make ResolvedStructType's instantiate method take a list of args but I can't do that because it wouldn't be an override anymore
 
sounds like you should make instantiate an external function
as in, not in the class
fun instanticantspellthisword(type: ResolvedType, ...)
or an extension function
fun ResolvedType.inwhatever(...)
then you can make pseudo-polymorphism by using when
 
alternately I could make the args a property of the abstract method and just not have all implementations use them
nah
actually, I could use an extension function to pull this off
probably
 
 
1 hour later…
8:43 PM
I keep expecting Kotlin's to operator to produce a range rather than a pair (like what's actually the .. operator).
Also, why can arrays not be const?
 
9:06 PM
because they cannot be JVM constants
@Bbrk24 you are looking for upTo
 
...right. Of course to and upTo both exist
 
theres also until and i think rangeTo
and downTo
 
9:26 PM
one thing that annoys me about kotlin is that it doesnt define a default companion object
leading to this behavior and not allowing to make nice List[1, 2, 3, ...] extensions
 
9:58 PM
@RydwolfPrograms duplicate answers are allowed
 
Ik
But invalid duplicate answers that violate copyright laws typically aren't :p
 
It wasn't 100% copied from the linked repository :p
Also, you only need the notice for copies of the full software or substantial portions with MIT
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 
Yeah the copyright isn't really any issue
I just needed three points for it to sound nice
 
@RydwolfPrograms this is probably the first time in a while I've actually properly read the mit licence :p
 
Everyone knows "MIT license" actually just means "you can have my code I'm too broke to sue you"
 
10:07 PM
You can have my code because I'm too flattered to complain.
 
To me it means "use it and if it blows stuff up that's on you idiot"
That's why I choose MIT :p
"do whatever the hell you want, but don't blame me for anything"
 
I just pick it because it seems to be the default and having a license makes my project more professional-looking
No one's ever going to use any of my code so it doesn't matter anyway :P
 
I'm just going to start using a license that mandates everyone to use my code in their projects
 
@user all the cool kids with golfing languages use MIT :p
 
"By reading this license, you agree to pay me $50"
 
10:10 PM
@user "hey wait gosh dang it not again"
 
@lyxal It's the closest I can get to MIT, since they didn't accept me :P
 
10:31 PM
@ATaco more like this lol
@lyxal when you use apache
 
Luv when Copilot spits out code and I have no idea how it works but it works and is much faster than my Naïve attempt.
 
11:01 PM
Are you absolutely sure it works?
 
Passed all my tests, so "Good enough""
 
11:21 PM
idk what it is, but there's always something nice about posting after a long break and getting a decent number of upvotes :)
Like, the long break makes the upvotes even nicer
Also, I'm 20 upvotes, and 28 answers away from a golden tag badge :D
 
11:49 PM
I had a long break, posted two challenges and they're both in my top 5
The latter of the two is my most upvoted challenge
 

« first day (4435 days earlier)      last day (401 days later) »