« first day (4173 days earlier)      last day (39 days later) » 

12:04 AM
@Neil Don't worry, even other sports fans' programs are being changed by sports - the cricket highlights are now at midnight instead of 7pm :/
@mathcat Should I be sad I wasn't included in this? :P
you might have been included
it depends on what "some professional challeng-er" compresses and almost decompresses to
12:38 AM
@Zionmyceliaadamancy ah, to coordinate with the crickets? /p
@user We don't have crickets here, we have grasshoppers :P
1:00 AM
Sandbox posts last active a week ago: Implement Binary Exponentiation
1:10 AM
^ any feedback on that
2:02 AM
@AidenChow lgtm
also, any feedback on this? idk, maybe it's a bit boring
i feel like my binary exponentiation q might be boring to do
the thing is, sometimes they don't get votes in sandbox, but they do great in main
to me, yours sounds much more interesting than mine :P
I'm just really bad at thinking of good challenges
or the opposite would happen, bunch of upvotes in sandbox but barely any in main
@Steffan me too lol
I'm really good at thinking of bad challenges
i only have like 6 challenges posted
2:08 AM
I only have 3 lol
I can't even really think of bad ones
And if I do think of one, it's usally a bad one.
any more feedback before i post?
Q: Implement Binary Exponentiation

Aiden ChowBackground In programming, there is a recursive algorithm called binary exponentiation, which allows for large integer powers to be calculated in a faster way. Given a non-zero base \$x\$ and a non-negative exponent \$n\$, the algorithm goes something like this (based on the example code from Wik...

2:36 AM
bro some guy on the desmos discord literally just did codegolf.stackexchange.com/questions/249439/…
like thats actually insane
guy doesnt know how to golf it tho, and idk what the guys code is doing :|
You can do basic golfing stuff right?
Can you send me the graph?
yeah i can do basic golfing stuff
takes a while to load
can u understand it at all, cuz i sure dont
I have AD running in the background so I'm not gonna try
2:45 AM
@emanresuA lol ye me too
3:04 AM
@emanresuA why u want to remove trailing 1?
Do we have to return the trailing 1? — emanresu A 19 mins ago
3:26 AM
given a list of even length, how do i make a dictionary from the list like so: [key, value, key, value...]. in python
3:36 AM
lot of ways to do it but if you're asking for the shortest... that's a very good question
@AidenChow won't say this is the shortest, but: dict(zip(*[iter(a)]*2))
that's fucked
what does iter do anyways
convert list to generator
makes a stateful iterator over an iterable
so [iter(a)]*2 is a list of two of the same stateful iterator
@UnrelatedString exactly
so zip goes [(next(a), next(a)), (next(a), next(a)), ...]
and zip(*[iter(a)]*2) then uses that same iterator as both arguments to dict, and yeah that
as both arguments to zip
zip(iter(a),iter(a)) will not work, becaues it's two separate iterators. ofc you could do zip(x:=iter(a),x)
because dict doesn't zip itself lmao
3:45 AM
oh nice, thats like super concise
the one time shallow copy is useful lmao
4:09 AM
@Steffan are you talking about wslg?
no that doesnt work for me
(wow that rhymes)
4:22 AM
> GitHub Copilot works so well because it steals open-source code and strips credit
i guess thats very true..
well i give credit
1 hour later…
5:53 AM
CMP: Are there any single byte atoms that you miss in Jelly?
i had some good ideas for elements.. but i fogor lol
6:05 AM
i dont even know all of the ones that are in jelly
6:28 AM
I just made a git commit with the hash fbbbbfbb
6:42 AM
i think i got most important stuff there
power set?
@PyGamer0 maybe also nand? :P
or honestly xnor would be more useful if you were only open to adding one more :P
wait tahts equal -_- i keep forgotting
dont listen to me then i am only wrong : - )
7:15 AM
@AidenChow Reasons
@PyGamer0 I think most golfing languages would benefit from an "are all the elements of this list equal?" builtin that returns the element if they are equal, but it's hard to add to Jelly because it's unclear what you'd return if they aren't all equal – an empty list, perhaps
so, e.g., applied to [2,2,2,2] it returns 2, but to [2,2,2,3] it returns []
also, a builtin for "function that maps these inputs to these outputs" would be very useful, but it needs a payload to specify which function, which in Jelly means adding a new sort of quote I guess
(I have something like six answers explaining how the construction works)
probably this would be a dyad, left argument is the function input, right argument is the function codomain
find-and-replace of substrings (rather than individual letters/elements) is also unreasonably difficult in Jelly, unless there's some way to do it with y
and y seems to also be single elements only
"select elements from list y that have the same indexes as elements that are truthy in list x" is useful and might be worth a single byte, but probably you could get away with it as a two-byter
(incidentally, with the standard int→list behaviour, this does the same thing as on integers, but might not be able to replace because it doesn't vectorise)
7:36 AM
I don't have any feature requests for Vyxal because they've all been added
I've also considered adding finite field builtins because they're so helpful for writing decompressors (which are often helpful in code golf), if you pick an appropriate representation for the finite fields they generalize well enough that they might be worth a single byte?
but maybe a bit specific
@ais523 Although we might add this, it could be useful
I feel like you could add a large amount of different string terminators to Jelly and it would still be competitive
@ais523 on that note maybe also some kind of... there's something dyadic this reminds me of that i know i've wanted several times but i can't remember what
my current plans for short finite field calculations in Jelly involve implementing a special case of when the right argument is an integer (this isn't useful in Jelly at the moment, I think?), giving a 1-byte representation for æc, and adding new a two-byte dyad for finite field inverse, but it probably isn't worth it
i think return 0 if left and right are equal else return left?
7:40 AM
Brachylog has an "assert rectangular and transpose" which is very useful there, but Jelly's bad at handling assertions, and last time I needed it I managed to make do with z
there are some things that come up repeatedly in code-golf challenges but feel more like library functions than builtins, such as flood fill and solving simultaneous equations/inequalities over the integer (Brachylog has builtins for the latter)
when you have a "solve these equations" task in Jelly, the normal solution is to calculate a number that's definitely larger than the solution, then brute-force all possible values from 0 to your calculated number until you find one that solves the equation
but this is inefficient (= hard to test that your program works), and often costs extra bytes both for the iteration and for the calculation of the solution
ooh, I know what would be a useful builtin, but very hard to implement – a nilad that returns "a sufficiently large number"
you would need a very complex static (or maybe dynamic) analysis to work out what number would definitely be large enough (defined as "choosing a larger number here wouldn't change the output of the program"), but it'd save bytes for quite a lot of problems
…do we seriously not have a "find and replace" challenge on main? I can't find one
we have lots of variations but I can't find the simple version
ah, here we go, it's on -4
(and IIRC there's some rule that challenges at or below -4 don't show up in various question lists?)
Vyxal has builtins for equations, but those use symbolic algebra for some reason
Nov 11, 2021 at 4:34, by lyxal
CMQ: What should a math-related digraph do on strings?
Nov 11, 2021 at 4:43, by DLosc
@lyxal Symbolic algebra /s
7:55 AM
my answer to that CMQ is "golfing languages shouldn't have a string or character type, a string should be a codepoint list"
Jelly loses bytes and 1-byte-builtin space to O and for no reason at all
there can be some potential benefit to having a string type if you have lots of overloads that act differently for strings to lists-of-integers, but I suspect the downsides of that outweigh the benefit
(note that for sites like anagol, you'll still need a little encoding space dedicated to specifying output formats; CGCC doesn't need that due to the flexible I/O, but an ideal golfing language would work on more than one site)
@ais523 Jelly has many codepage slots that yet aren't taken. I don't think it matters.
i feel like having them distinct wins; there's not a ton of math that ends up useful on something that's conceptually a character, and for the math that does end up useful on characters then you can overload it for that
most builtins aren't math-related though
@emanresuA if you want codepoints in a particular program you still have to use those
Up to a point, more datatypes = more overload space = more power. I'd argue that a regexp type could be quite useful
8:00 AM
one really big gain from merging string and list-of-integer types is with nilads
you can't overload a nilad based on its input, and if you have two separate output types you need two separate nilads
A few days ago we were discussing having only homogenous lists or similar
(and maybe tuple types)
e.g. “…‘ and “…” in Jelly are conceptually the same nilad, but one returns a codepoint list and one returns a string
It almost never matters whether you're using base-254 or base-255 compression though
programming languages benefit from an easy way to represent a tree structure
@emanresuA huh, I disagree, I've lost bytes to that in most of my longer Jelly answers
Hm okay
8:03 AM
if your string is long, the base-254 vs 255 difference will be significant
a base-250 string is 0.4% longer than a base-256 string representing the same thing
so it costs 1 extra byte for every 232 bytes in the string
that's actually a smaller difference than I thought
but the problem is, that the number of lost bytes is rounded up
I think it's probably better for golfing languages to use length-prefixed rather than terminated strings for this reason; you don't start losing bytes to the need to round up until the string gets long enough that the length prefix costs multiple bytes
Have a hug, pxeger :P
in hex, that number is 0xF3A686A9D98A41BDA0298B58BE9B1840
8:12 AM
@emanresuA thanks lol
was a bit unlucky it starts with an F, but being near the top of the range to fit in 17 base-256 digits means that it overflows into 18 base-250 digits
…that said, it also overflows in base 255, so it was the choice of delimited strings that cost rather than the number of closing delimiters
@ais523 cool flax doesnt have strings
@ais523 infinity?
> giving a 1-byte representation for æc
@ais523 I've thought about that many times before . You'd probably want a monad
@ais523 what is that? does it error if the array isnt rectangular?
@ais523 how about returning the first non equal item?
May 6 at 6:05, by PyGamer0
^ i love that overload :p
its the best
@ais523 i didnt understand any word of that
8:43 AM
@ais523 how about "return elements that differ from their predecessor?"
2 hours later…
10:26 AM
@Steffan wow nice
10:48 AM
3 feature requests/bugs:
1. Multiline-Comments dosn't work
2. Skip single-line posts
3. Increase Icon contrast?
11:08 AM
@ais523 i have no idea what finite fields are lol
11:51 AM
@ais523 n^n where n is the input (or its length, for lists) would probably be sufficient for most uses
12:17 PM
CMP: Should there be a single byte builtin for x**x
CMP: Should ring translate be single bytes?
12:37 PM
Is there an XML feed for new cgcc posts?
@mathcat do you mean RSS/Atom? codegolf.stackexchange.com/feeds
oh right it was rss
working, thanks
1 hour later…
1:57 PM
@PyGamer0 No
@PyGamer0 Yes
currently its a diagraph, i may promote it to a single byte if its useful enough
so as of now in wishlist for single byte builtins we have:
- 12 nilads
- 77 monads
- 68 dyads
- 43 quicks
Like in vyxal, ring translate is an overload of multiply
200 codepage space filled already
Use overloading
2:12 PM
:/ first i should have actual types to overload with
number ,string, list
oh you don't have string
but you still need string builtins
i have some
lowercase, uppercase, swapcase, etc.
split on
well that's a list builtin
2:15 PM
200 + 13 (digits + signs) + 5 (train separators) + 10 (something i forgot)
228 spaces filled
so 28 spaces should be left which i will reserve for now
what's the fifth separator
oh is it map-monad
should have a filter-monad like caird's fork..
CMC: given n, output the length of the concatenation of all numbers 1 to 10**n in decimal. Time complexity must be polynomial in n. (so you can't just generate the string)
2:17 PM
you can also overload quicks for monad/dyad
Huh that's an interesting challenge
@Steffan i have done that
or generalized behaviour
I think Jelly could have half as many quicks as it currently has if it overloaded some of them
is @Zionmyceliaadamancy's fork's behavior for fold and scan when the link is a monad useful in challenges?
cause i can swap it out for scan and fold fixedpoint as k does
@PyGamer0 normal Jelly already has quicks for those btw (although they're digraphs)
@pxeger it's got more dyad-only quicks than monad-only quicks (and a fair number that work just as well for both) but yeah it could definitely stand to gain from overloading
...the wiki claims ' is overloaded but i'm pretty sure that both versions are broken
or maybe ' on monads does technically work but it's almost useless? supposed to suppress vectorization
i know the intent of the quick was for like having <' do lexicographic comparison but on dyads it's just a janky version of þ
i think "spawn" is just what someone decided to call the broken table behavior and it was supposed to suppress vectorization for both monads and dyads
also the notion of "suppressing vectorization" is honestly kind of emblematic of how deeply broken this language is lmao
that relying on dynamically typed python directly under the hood could actually be part of the design
of course there are list builtins where it makes sense, operate on the first axis versus the second or last
2:38 PM
@UnrelatedString Yea, for example U' works
also bad example considering exists but it's the only non-digraph i can think of lmao
@UnrelatedString It's a good example for why ' is practically useless :P
also not useful since there's <code>;`</code> but yeah
@UnrelatedString ooh, that might actually be useful
;` is kinda clunky tho
same length and still a monad
2:41 PM
so should i add a quick which supresses the vectorisation?
holy shit how do i do that
you don't :P
my vectorisation isnt handled in the dyadic_link function
in fact i dont have that function lol
jelly's system is a mess to begin with and even that didn't let it work on dyads
@UnrelatedString oh ok makes life easy :P
for anything where that notion makes sense to begin with you can just make a separate digraph
2:43 PM
well true
@UnrelatedString one problem with my vectorisation is that it can only either fully vectorise or not vectorise at all
i guess letting the dyadic_link do the vectorisation is easy and clean
Q: Is it an ordinal?

AnttiPBackground (feel free to skip) Ordinals are the abstract representation of well-orders. A well-order of a set is a total order, which basically means that every element in the set can be compared against any other element in the set, and one of them is either smaller or larger. Also there are no ...

my vectorisation is sad ngl
A: Sandbox for Proposed Challenges

Matteo C.Draw the USA flag I noticed that it seems nobody has posted a non-ASCII (related) USA flag challenge yet, so what better time than the 4th of July? The Challenge Draw the current (as of 2022) flag of the United States of America. Here is the flag: Specifications Hoist (height) of the flag: A =...

3:18 PM
@Zionmyceliaadamancy not ' related, but this inspired me to do something horrible
3:29 PM
Is there some haskell library that exports the fix type level combinator? I can't find one.
4:17 PM
@Neil Solution: 4Sin[Pi/12#]^2&
4:42 PM
@UnrelatedString Feels like there's some quineing potential here :P
2 hours later…
6:51 PM
I feel like it could be a bit boring in golfing languages, but it might be interesting to solve in normal languages
Idk tho
7:28 PM
Looks good, although I'd be worried about dupes
I don't think it's a dupe
Well, I'll post and see if people VTC :P
Well I was going to paste a message about how I'm planning on starting on RTO again soon
Q: Get multi-dimensional indices in a list

SteffanGiven a matrix of non-negative numbers (of arbitrary dimension) and a number, get all multi-dimensional indices of the number in that list. For example, let's say we have the list [[0,1,0],[1,0,0]] and the number 1. In the first list, we see one 1 at the second index. If we were using one-based i...

@RadvylfPrograms nice
This is the closest I can find to it.
7:37 PM
:61507282 disadvantage of the "paste to send images" userscript
yeah lol
wait it isn't working
> Failed to upload image, please try again!
2 hours later…
9:50 PM
Q: Bijective Function (\$\Z \rightarrow \left(\Z \union \Z^{2} \union \Z^{3} \union \ldots \right)\$)

dancxviiiFind a bijective function which maps integers to arbitrarily large tuples of integers. Given the input \$n\$, output the tuple it matches to.

Looks interesting but it needs fleshing out
10:06 PM
Apr 21 at 2:41, by Radvylf Programs
Followup announcement: I'm going to be really aggressive about moving off-topic stuff for the next week or so, probably more so than is necessary, but this can be a sort of...practice
3 months later:
Well, it turns out aggressively keeping the room on-topic is actually really helpful
1 hour later…
11:27 PM
I'm back
Didn't even notice you gone
Jun 29 at 12:52, by Seggan
also, I'ma be gone till Monday, so don't summon me
/summon seggan
Spawned 1 Seggan
Oh no, now there are two of you
11:33 PM
wait what
I accidentally duplicated you
Like that
You can now golf twice as fast
CMQ: Would you use a light terminal theme? Why or why not?
11:38 PM
I have at one point because dark mode hurts my eyes. It looked off, though
Also, if you use a light theme in an IDE/editor, the integrated terminal also gets that theme, so I guess I've been using a light terminal theme nearly every time I've used IntelliJ or VS Code (I recently made my VS Code terminal black, but only so it would fit with my new Powershell and Zsh themes)
Definitely not
I need to change my pfp
@Steffan Change it to ^
@NoHaxJustRadvylf no. light mode = blindness
Only if you're a vampire
11:47 PM
I'm a vampire then
I guess I am too
@emanresuA is it just me or does someone already have that pfp on here lol
Not afaik
I guess I'm a vampire too because light mode doesn't blind me
Other way around
You're not a vampire
11:50 PM
Oh bruh lol
I prefer dark mode though
The thing is, why aren't you blind? CGCC doesn't have dark mode :P

« first day (4173 days earlier)      last day (39 days later) »