« first day (4564 days earlier)      last day (575 days later) » 

00:00
0
A: Sandbox for Proposed Challenges

Huỳnh Trần KhanhCan you swap? code-golf Today's problem is easy. You're given two strings A and B of equal length consisting of only the characters ( and ). Check whether after a few operations you can make both strings balanced or not. The only operation allowed is swapping A[i] and B[i], where i is an arbitrar...

@Simd if I understand what you want, I think (</¨⊢⍤/⊢)⍤,⍤(∘.,)⍨2÷⍨2+/0,⊢,1+⌈/ works it
I take all pairs of the 0,list,1+max(list), average them, then take Cartesian product with itself and filter for the ones where the first is strictly less than the second
would that be a correct algorithm?
"all pairs" means consecutive pairs, so 0,list[1], list[1],list[2], ..., list[n],1+list[n]
 
4 hours later…
04:20
0
Q: how do i solve this version of the goat problem

Harry JohnsonA goat is tied to a triangle pole with side length 4m, the rope is 12m long. a) show that the distance the goat walks in one revolution is 16pi meters b) find the area of the shaded region c) what is the area of grass that the goat can graze d) repeat parts a,b,c for a pole with a square base of ...

 
3 hours later…
06:59
@NewPosts are there any resources for default string compression for the various golfing languages?
øD, øc and øC in Vyxal for dictionary, alphabet and number compression respectively
Other languages have information on their tips questions
07:24
@RubenVerg I can’t see it run sadly
@RubenVerg perfect!
I think it can be golfed much further, the real issue was figuring out what the problem wanted
so I didn't want to spend much time optimizing a potentially wrong solution
@RubenVerg that is always the problem :)
07:53
which language are you using?
08:50
@lyxal how do you use them? the first one gave me a longer string and the other two threw an exception
09:02
actually it wasn't longer I was just measuring the wrong thing
@Neil øc expects a string of letters in [a-z ] and returns the base 255 compressed version
øC expects a number and returns the base 255 compressed version
@NewPosts I went through all the string compression generators I could find. They were terrible. It seems that in most languages you'll actually need to manually compress the string, e.g. by repeating the tail. The one exception is Charcoal, which naturally compresses the string to 320 bytes.
(in other words, trying to do manual compression actually results in longer code)
09:18
Should the challenge be considered a dupe of the rickroll challenge?
Given it's just compressing a large chunk of text + some repetition
Feels like it would be a challenge that has been asked before
@lyxal other similar challenges have in the past
So yeah you could
(I'm so tempted to use my dupehammer rn)
That's why I asked here first :p
@TheThonnu it can always be reopened if need be
Go on, give it a crack
No way
That's so cool
Unilateral decision making can be fun sometimes :p
although sometimes you wish that some things weren't unilateral and or binding
Show-off :p
Don't forget we're the ones who voted for you lol
09:30
I'm just saying it'd be nice to have an option that wasn't binding
Like a toggle switch
Yeah fair enough
I'm not the only one who's said things like dupe hammers would be good as opt in
Jul 24 at 4:09, by The Thonnu
ik it means that you have to be completely sure before you cv
It's a good idea 99% of the time to have it automatically close, but there's always 1% where you want to get more feedback while still performing an action
@TheThonnu well not completely
It can always be reopened
Well, a dupe hammer at least
Ooh you can add additional posts a post is a duplicate of if you have a hammer
I wonder how long that's been a thing
09:48
@lyxal you didn't know that?
I found out when that happened to my question on MSO last August
But it's definitely been around a lot longer than that
@lyxal For many years at least
10:39
@TheThonnu I've only had a dupe hammer here, and only posted like 1 or 2 dupes back when I didn't care about moderation tasks (like mid 2019)
I also don't typically go back to duplicate questions :p
So I've never really had a chance to look at the modal closely lol
 
2 hours later…
12:56
Anyone have an invite for the CGCC Discord?
one seocnd
careful, that link enables PvP on your account :p
PvP?
(look at the link url)
Oh it's a joke
you expected anything less? :p
13:00
From you, I guess not
PvP = Player versus Player
Yeah ik what PvP is, just was confused because I don't know what it would mean in the context of Discord
It means you can fight people in real life
13:15
0
Q: Can you perform swaps?

Huỳnh Trần KhanhToday's problem is easy. You're given two strings A and B of equal length consisting of only the characters ( and ). Check whether after a few operations you can make both strings balanced or not. The only operation allowed is swapping A[i] and B[i], where i is an arbitrary index. Tests: ( ) -> f...

I am running an optimization where I have to find the optimal set of intervals between 0 and 100. I thought it would be fun to see the intervals change live graphically but I code in python. Anyone know if this is plausible in python?
I use matplotlib to plot things but never for anything animated
@NewPosts second challenge in a row that was in the sandbox for less than a day
13:47
I've been waiting to use that one for a while :p
14:12
anyone have the link for lumenspire or whatever it was called? can't find it
0
A: Sandbox for Proposed Challenges

abyss.7Pack the sequence! You have a list of sequences of numbers (1 byte max, unsigned) as an input, e.g.: 4 6 4 9 3 15 150 3 2 1 9 6 4 1 … Your task is to pack as many of them as possible into the square composed from the numbers from this list - the size of square is also an input. The square of siz...

@lyxal i thought i was in the CGCC discord for so long and only just realized i was only in the gaming one...
@noodleman nevermind, found it
@TheThonnu This is regarding this question: codegolf.stackexchange.com/questions/263479/… I would argue in fact that while lots of string compression questions have been asked, some of them are somewhat interesting and we shouldn't just close all of them just because "string compression" has been asked before. But this is kind of a matter of personal opinion on what things are interesting and different.
14:28
@joyoforigami generally, the reason challenges like that are closed is because they are all very similar and rarely have much challenge to them
if we let every string compression challenge stay open it would get pretty boring since submissions can use very similar techniques in all of them, which is basically how duplicates are chosen on this site (can submissions from that challenge be trivially changed to work for this challenge?)
question: should an image of a table be replaced with a markdown table? the table is not very large, but the challenge cannot be solved without the table.
i'm going to go ahead and edit it but not entirely sure.
@Simd optimized how?
@Simd You might want to consider doing 3-dimensional graphs instead: geeksforgeeks.org/…
c--
c--
@Simd did you look into matplotlib.animation?
@Simd if you need a higher dimension then you can use graph colouring to represent higher dimensions.
14:53
@c-- I didn't know about that!
I want it to update as the code runs
c--
c--
I don't know how fast your code runs, maybe the default interval isn't good enough for you, maybe you need to run the computation in a different thread and skip frames?
I'm only familiar with FuncAnimation(TimedAnimation)
I will check it out, thanks
c--
c--
this may be overengineered but for real-time computed values your best option might be to subclass Animation providion your own event_source
I haven't looked into that though
maybe first try a simple solution like this, and if that doesn't work look into more complicated stuff
15:59
@c-- thank you!!
 
2 hours later…
17:35
bbrk24@cdlemon:~/workspace/Trilangle/wasm$ gzip index*js -kS .gz
gzip: index.js.gz already exists; do you wish to overwrite (y or n)? y
gzip: index.min.js.gz already exists; do you wish to overwrite (y or n)? y
bbrk24@cdlemon:~/workspace/Trilangle/wasm$ yes | gzip index*js -kS .gz
gzip: index.js.gz already exists;       not overwritten
gzip: index.min.js.gz already exists;   not overwritten
You have defeated the entire point of yes :facepalm:
gzip has -f doesn't it
You have defeated the entire point of stdin :facepalm:
gzip by default compresses stdin to stdout, unless it sees stdin is a terminal, in which case it guesses you want to do something else
-kS .gz means "keep the original files and create new ones with the .gz file extension"
anyways, gzip index*js -fkS .gz is what I wanted
@Neil It only wrote to stderr, not stdout
Anyways, I'm trying to determine whether minification is even worth it
$ wc index*js*
  446  1408 14164 index.js
   15    97  3981 index.js.gz
    0   110  6897 index.min.js
    7    55  2532 index.min.js.gz
  468  1670 27574 total
Right now I'm leaning towards "no"
18:13
I have 2 numbers in rust, I want a tuple or a array containing the smallest first and the largest second. What's the golfiest way to do this?
Is there no minmax builtin?
C++ has std::minmax
Not that I can find, maybe under a different name
If you have exactly two numbers you could probably do sth like [a,b].sorted()
Sorted does not exist either :/
That exact code snippet would work in Swift :P
18:18
(This is where I want to use it btw, codegolf.stackexchange.com/a/263499/91213 I'm need it twice so an efficient method would save a significant number of bytes)
ah I see
Mousetail-Inspired-CMC: Given an array of numbers or multiple inputs, output the smallest item first and then the biggest item second. You may also output as an array containing these outputs.
Currently I do (a.min(b),a.max(b)) but it's long especially if a and bare expressions rather than single variables
@TheEmptyStringPhotographer C++: std::minmax :P
(tbf that does take either two numbers or a std::initializer_list so not an array properly, only an array literal)
I guess python would be, for an arbitrary list lambda a:sorted(a)[::len(a)-1]
18:26
{($0.min()!,$0.max()!)} in Swift
If I add a bounty to my how quickly do I need to time the code on my PC? Should I time any new submission or would be ok to time them all at the end of the bounty?
I'm sure people would appreciate if you timed them fast so they have an idea if they are set or need to improve it more
@mousetail ok thanks. I ask as I am going away for a week. I won't put the bounty on until I am almost back in that case
@mousetail another question... does anyone care how large the bounty is?
18:42
@Simd any sized bounty will probably attract more answers, since it will put the question onto the "bountied" tab. But ofc, the bigger the bounty, the more people will be encouraged to write up an answer.
@TheThonnu thanks. I wonder if there is data to support that hypothesis
I don't think there are many people on this site who go for bounties in general, it's too easy to gain rep normally
@mousetail I do! :)
You have 0 answers so clearly not
@mousetail I mean I give away bounties
18:46
I mean people who would be more likely to solve a challenge because of a bounty
If a challenge looks fun and interesting, I'd solve it regardless. Otherwise even a bounty wouldn't persuade me, I'm here for fun.
ah ok
I'll add a bounty in a week and I hope it will encourage answers!
There is not that many posts here that I need to plan which ones to solve, I solve all that interest me
@mousetail you could win easily currently :)
I don't enjoy solving fastest code challenges
:(
18:49
I'm really interested to see what the best answer will be though
I hope they find an interesting algorithm and not just basic optimizations
me too!
sometimes there is a clever method to make things go fast that isn't provably better
those are cool too
If it's algorithm specific
If the optimization is just "I used threads" then I'm not that interested
full of very clever tricks of different sorts
Intrinsics :/
and a clever algorithmic speedup!
it's got everything
18:54
I'm still salty about the one time I tried to solve a fasted code challenge and I used platform agnostic SIMD and then another answer had basically the same but used intrinsics for SMD and it was like 4 times faster
Argh. Which challenge was that?
Julia is pretty good for these things these days but we don't seem to have any Julia lovers here
You won't beat those answers that are half assembly
19:16
@mousetail lambda a:(min(a),max(a)) is shorter and more naïve.
i don't like answering fastest-code since the only praclang i'm good with is JavaScript
JavaScript is on par with Java in terms of performance, which surprises me
my only fastest-code answer was just ported to C by somebody else and demolished
but modern V8 is really well-optimized
@noodleman yeah that's one thing I don't like
@Bbrk24 not in general tho
19:21
plus you can just throw -fno-exceptions -fno-rtti -flto -O3 on any C++ answer to instantly triple the runtime speed
@Seggan What do you mean by that?
@mousetail I guess that is true if the assembly coder is really an expert. It's hard to write good quality assembly though
19:44
CMP: Who thinks codegolf.stackexchange.com/q/263479/114446 should be reopened?
I'm starting to think that because of the repetition it is slightly different from the other challenges
dupe target also has repetition, to be fair :P
but yeah it's definitely structurally different
but also a ton of it has barely any structure
also speaking of structure i'm beginning to wonder if someone's already cracked this and it's just taking this long to actually write the next answer :P
@TheThonnu If gzip is the shortest answer it's a dupe, in this case gzip seems to be the shortest
zlib is shorter than gzip :P
also we haven't seen any golflangs with built in dictionary compression take a crack at it yet
a boring challenge for praclangs might still have some merit there
20:04
That's true
@Bbrk24 Multithreaded, perhaps?
new Worker
You can do multithreading in JS via workers
Yeah, but is the performance better than multithreaded Java?
20:11
no idea
20:49
I think they mean Java's better in ways other than performance? But not really sure how that'd be relevant if JS is just a compilation target
We were talking in the context of
and obviously neither Java nor JS will beat anything compiled natively
Altho JS can get close :p
I was saying that JS and Java will be similar to each other
but yeah asm.js is a thing
Nah I just mean V8
It's slower than C/C++, but only by a single digit multiplier, which is pretty damn impressive for what it is
yeah modern V8 is impressively well optimized
I mean I guess with the whole internet basically depending on JS being fast, there's a lot of incentive to make it that way :p
@RydwolfPrograms I know I should be happy V8 is that good, but it just makes me sad because of all the interpreted languages that exist, JS got chosen to be the backbone of the internet
It's not an awful language but it's an awful language
@Adám You gotta make Dyalog APL target WASM so it can take over the internet :P
wasm still can't manipulate the DOM
I don't want to live in a world where every website uses JS on the frontend and backend and every mobile and desktop application also uses JS
@Bbrk24 Wait, it can't?
nope
21:03
IMO a sort of machine code should've been the scripting language of the internet
That's pretty limiting
wasm applications can but only through a stupid js api
@user We're already looking into it.
Nice
Maybe like a super-CISC that's a superset of most of the common architectures (x86_64, arm64, RISC-V, etc.), where every instruction can be broken down with a lookup table into an instruction, set of instructions, or library call for the platform it's being run on
21:04
@Bbrk24 and @Seggan, re: the Common Golfing Runtime, is it going to target WASM or just JVM, JS, and native executables?
Are we doing native?
idk, I assumed we were given Kotlin compiles to it
We only have Complex impls for JS and JVM
(also can you add me back to the GitHub org? I left it)
sure
21:05
Thanks
Ooh can you add me too
@Bbrk24 Oh I thought you just needed a single impl for all the platforms
Well we're using different BigDecimal libs for the two
Ah
If JS is already a target, Wasm's probably not that important right?
21:06
Yeah
@user What's your GH username again?
ysthakur
Got it. I knew it started with ys but I couldn't remember the full spelling
But I hear WASM's going to be used for more than web stuff in the future (heard something about how it would've made Docker unnecessary if it'd come out sooner, although I have no idea how it would've done that)
@Bbrk24 Here's a handy way to remember: it's rukahtsy backwards
Huh, GH has a special dialog for "This person used to be a member, are you sure you want to reinstate them?"
21:08
Thanks!
@RydwolfPrograms I would want to run that by @Seggan or @lyxal first so I'm not unilaterally adding new members. (I forgot Lyxal was even part of it)
@user Yeah no I think the major advantages of OCI/containers are kind of orthogonal to those of Wasm-not-on-the-web
Well the docker thing was about WASI, which is similar to POSIX but different
Oh
but WASI was designed for wasm so
21:10
I'm still not sure it does what containers do
More GH actions questions: If I have push: branches: '**' do I need pull_request?
wait I could just see if the workflows ran on the PR you opened the other day :P
they did not
Also, why are my commits showing up as "8 hours ago". Is there a timezone problem
I forget, is a debugger on the roadmap for CGR? Because without one, it wouldn't really have a ton of advantages over a plain golfing library
@Bbrk24 Your commits simply time travelled
Make sure to never mess with git history
It wasn't doing this last night
this is new
Even git log locally shows them at the wrong time so something is up
@Bbrk24 in specific cases, yes, but not in general
247fb01 was in fact committed at 2:30 in the morning. 11acfa2 was committed this afternoon. Sometime in between those commits, git got messed up
21:19
Is it a thing with your own computer?
Try making commits from GitHub directly, or some other device maybe?
@user WASM kotlin support is still experimental, besides we have JS
Right yeah
No native either right?
In general WASM is a more suitable compilation target than JS if you have the choice
@user @Seggan Also this
@user go write a BigDecimal impl in native, then sure, go ahead :P
@user not really, but its a great idea
21:21
@mousetail It's going to depend on some JS libs, not sure how easy it would be to access them from WASM
I committed just now and it showed up as being at 8:32 so it's not even a timezone thing. It's 8 hours 48 minutes out
Is your system clock off?
nope
It's quite easy to call JS function from WASM
21:22
ET gang
im actually thinking of moving to rust, since it can do wasm too
@user I thought you were in India
No more JVM tho :(
@Bbrk24 I haven't been to India in 7 years lol, I live in Maryland
@RydwolfPrograms pass this 1024 question exam firstt then well let you in
@user i agree, the JVM is nice
Nah but if Rust makes things easier let's go with that
21:23
CLR is better
NEVER
Also, having to target multiple platforms is tough
@user it is?
But yeah I don't have a JDK on my new computer so Rust would be nice
@Bbrk24 Less optimized + Microsoft + CLR + doesn't run on a gabillion devices
21:24
@user as in the wasm/desktop thing or multiple native targets?
No as in JVM and JS are multiple targets for the current Kotlin impl
oh I figured it out
Isn't supporting multiple native targets in Rust like, really easy?
@user exactly
$ date
Sat Jul 29 08:36:31 EDT 2023
21:24
@user kinda the biggie is with math stuff
wasm-bindgen in rust contains convenient wrappers for most JS functions and types making it convenient to cross lanuguage bounderies whenever you want to
Also, if the goal of this is to be a runtime, it seems like depending on a second runtime would be kind of silly
@RydwolfPrograms Was talking about how CGR currently targets JVM and JS, not that
Downside is it's quite large in terms of binary size
@RydwolfPrograms too meta for you?
21:25
I found out why this happens, btw: it's a known issue with WSL2. stackoverflow.com/questions/65086856/…
@mousetail Nice, so Rust effectively gets us CLIs and browsers
oh yeah that
@cairdcoinheringaahing (pinging you since ure the most recent one in here) can you unfrz chat.stackexchange.com/transcript/144825?
im so annoyed ROs cant unfreeze
i used to have to deal with that all the time but... actually i can't remember if it stopped or if i just stopped doing online stuff through wsl :P
@RydwolfPrograms whats ur GH
21:28
Radvylf
done
i sadly cant work on CGR today, got other priorities, but might monday
If we're redoing it in Rust, performance might be a thing
It might be a stretch to say that a golflang will become competitive for
@Bbrk24 Myxal go brr
but I can imagine that Vyxal in CGR will be faster than Vyxal in Python, because Python is so slow
@Bbrk24 you ever doubted the JVM's performance? how dare you
@Bbrk24 Vyxal 3 is in Scala tho
21:38
Oh
right
Since we're dropping the JVM, we can at least expose Python bindings so that people can use it as a library
@Seggan The JVM is pretty good, but native is even better
@Bbrk24 Jelly programs go from running in 600 billion years to merely 500 billion years
4
*brachylog
jelly tends to outperform the language that basically has brute-forcing as a primitive :P
@user i disagree, in terms of performance
sure hyperoptimized native will be faster, but not if ure the average coder
and ofc, the JVM really shines once its warmed up; cold start JVM is pretty slow compared to native
I assume this new version of the CGR won't be coded so horribly that Java would be faster :P
erm i think its hard to beat a JIT lol
21:46
@Seggan A lot of programs are pretty short-running and will only be run once, so native would be better there
@Seggan Is it?
yeah
don't jits tend to lose to full ahead-of-time compilation
depends
@user itsnt that the whole point of JITs?
@UnrelatedString i dont think so
21:47
You can do some extra optimizations with JIT that you can't with AOT but AOT still compiles everything, right?
In some cases JITs are better because you can use it to specialize tight loops
jits are way better than straight interpretation but oh interesting
@Bbrk24 not just
heck, someone made a C++ JIT for that reason
21:48
Whoa, interesting
IIRC the reason JIT compilers can be faster is that they have access to the specific machine they are running on + more metatdata than an AOT compiler
22:05
@Seggan haha I have done this myself :p
Refresh the page
@Seggan aren't JITs slower typically?
Depends on the application
Are there any languages with both AOT and JIT compilers where the latter is faster?
@Simd Java :P
@lyxal you spy
22:09
@Seggan does it have an AOT compiler?
I guess it compiles to byte code
@Seggan nyeh heh heh :p
@Simd Graal Native Images
Is it slower ? I have never tried it
@Bbrk24 I forgot I was part of it too lol
Julia really needs that
22:12
holy cow lyxal
the message spacing
@Bbrk24 and that's why I fight for you Alberqerque!
Is it possible to propose a challenge that is beyond RE-complete?
@Seggan I find it hard to work out which is faster!
@Simd Also Kotlin (Kotlin/Native being the AOT)
22:15
Is it the AOT compiled version?
The JIT will have to warn up
22:35
@Simd Kotlin/Native is slower than Kotlin/JVM

« first day (4564 days earlier)      last day (575 days later) »