« first day (3815 days earlier)      last day (1031 days later) » 

7:04 PM
wait, the apply-at-indices quick is really cursed (¦)
ok so (cc @cairdcoinheringaahing idk if you already know this) instead of calling the link on the specified indices, it calls it on the whole list, then zips the result and the original list together and selects the result if it's in the index set and the original otherwise
 
yep
it it so fucking cursed
 
@N3buchadnezzar shame! You can still win in python though :)
 
@hyper-neutrino I mean, it works
 
e.g. 10,11,10,11,10 M2,3¦ returns [10, 4, 2, 11, 10] because M returns [2, 4] and so [2, 4, 2, 4, 2] and [10, 11, 10, 11, 12] are interpolated together, selecting the 4 and 2 for the second and third positions and the original elsewhere
@N3buchadnezzar not the way it looks like it should tho
 
it's a nasty thing to remember when you try giving it something that doesn't vectorize the way you want it to and oops guess you need
 
7:06 PM
ok well this explains why this thing never works the way i want it to
i guess it's more versatile without implicit but from the wording it really seems like it should
 
@hyper-neutrino I mean .. Jelly does not look like it should work at all from the outside XD
 
also unless i'm misremembering it also doesn't have the same nifty non-integer handling as
 
@N3buchadnezzar *from the inside too
> return [ret[t % len(ret)] if t in indices else u for t, u in enumerate(larg)]
no, it does not
this is why i'm making documentation for everything in my jht site
 
i have wanted to use to apply something to the first and last elements many a time and it has let me down
 
the number of times i've had to search through source code to understand something is ridiculous lmao
 
7:08 PM
oh yes
^
 
so i'm just writing descriptive explanations of how something actually works if it's unintuitive from the wording on the wiki (which is like half of everything)
@UnrelatedString yeah that'd be so nice to have
but nope it doesn't even work for negative indices it seems
 
Wait it doesn't?!
 
oh wait, it does
 
because of the mod
 
but it doesn't wrap
> indices = [index - 1 if index > 0 else index - 1 + len(larg) for index in indices]
 
7:09 PM
...oh
wait yeah nvm
 
the even more cursed part about this is that it means if your list has some values that would error under a certain link, it will still error even if you don't even want to call the link on those values
 
Sounds like it'd be a bug...why would it be intentionally implemented like that?!
 
@LuisMendo I couldn't find anything related to the problem you posted today, on math.SE, Do i have your permission to post it there?
 
@hyper-neutrino Yep, I knew that :P
 
nice :p
@RedwolfPrograms well, the thing is it's not really a bug, it's intended to work like this
it's just that... the description / quick name isn't accurate
 
7:16 PM
Even worse is if you're using head/tail, so it modifies every element
 
the description just says "Apply link to items at specific indices." which is totally different
TBH the jelly wiki isn't that great IMO :p
 
I should probably rework that in my fork tbh
 
What advantage does Jelly's way have over doing it the normal way?
 
It's easier to write?
 
it's more flexible
 
7:17 PM
Well...other than that are there any?
 
if you want to apply to each it's just one byte (euro)
if you want to be able to process the whole list and interleave elements by indices, it would be harder
although TBH the second isn't that hard to emulate with an interleave + using head/tail on each index with the "normal version" of this quick
and i think the first application is much more helpful
 
Oh yeah, forgot Jelly has mutable things
 
@hyper-neutrino Isnt a interleave easy in python wth zip?
 
@hyper-neutrino It was written by about 5 different people tbh
 
@N3buchadnezzar i meant in jelly itself
IMO when choosing behavior for a built-in, if two are of similar commonness, the one that is harder to do otherwise should be used
so modifying the source list is a good design choice, because if you need the first element without modifying, you can just do ḷ/, but if didn't modify, there isn't really a good way to get a modifying version of it
granted, you can also restructure your code to be more functional and not require mutation but it's a 1-byte diff vs potentially needing an entire rewrite
 
7:22 PM
TBH I think having mutable arrays is kind of cursed
 
occasionally useful but yeah cursed
 
Can Jelly write to a file?
 
only with python
 
@hyper-neutrino My biggest philosophy when choosing builtins is to "minimise the number of NOP"s. If your language is competititve here it's not golfy enough
 
@RedwolfPrograms Having mutable arrays by default is kinda cursed, but they should be an option
 
7:23 PM
In a tacit/prfix/postfix language it's kind of weird though imo
 
In a tacit language, definitely
 
i'd generalize minimize nops to minimize redundancy
 
Tacit programming is cool
Might learn a bit of Haskell to try it out
 
too many nops is just an overabundance of ways to express the identity function
corner cases that error are an overabundance of ways to error
 
Haskell is tacit?!
 
7:26 PM
by some definitions, pointfree is tacit
er
 
@user if you program point-free then it's tacit
 
Bah, that's pointless
 
what golfing languages allow read and writing files?
 
by the actual definition of not needing to refer explicitly to arguments, pointfree is tacit, as is stack-based
 
Well you can use variables in most languages, like APL
 
7:28 PM
@Anush No good ones
 
^
 
@RedwolfPrograms good in what sense! :)
 
file io is extremely marginal
 
So how many languages are only tacit? Not that many I would wager
 
There's not much need for that in golfing, unless you're using something with an "evaluate as non-golfing language" builtin
 
7:29 PM
And I really don't like those
 
wait point-free is stack based?
 
or something like japt's $$ where you don't actually evaluate js code you just put it directly into the transpiled result
 
@N3buchadnezzar J was kinda sorta only tacit, since defining a new function with explicit variables required putting it as a string or smth, but it can now directly define functions iirc
 
@hyper-neutrino The other way around
 
@hyper-neutrino No?
 
7:29 PM
@hyper-neutrino call stack? does that count lol
 
@N3buchadnezzar neither
 
oh wait
i misread unrelatedstring's message lmao
 
How is stack based point-free?
 
stars "i am very smart"
 
@user that's hard to judge. If you want a golfing language to do what a normal language can but in fewer bytes there are plenty of tasks that include reading and writing files
 
7:29 PM
@N3buchadnezzar stack-cringe?
 
stack-based doesn't refer to arguments explicitly
 
heap-based?
 
so it is tacit
 
I guess concatenative languages often use combinators, and are kinda sorta tacitt, but not really
 
7:30 PM
@pxeger wait this is a good idea
 
@N3buchadnezzar hard to say. You could say defining a function is assigning to a variable, in which case you can't define your own commands in a completely tacit language
 
@user I am very dumb and missunderstood Hypers message
 
@Wezl if you have enough combinators you can solve that issue :þ
 
@Anush Well, not a lot of challenges include that stuff, and golfing languages aren't for golfing general code, they're optimized for the kind of challenges we get here
 
enough combinators >= 1
 
7:31 PM
@user that is a bit circular. I often want to pose a challenge and am not told not to because the golfing languages don't support some part of it
 
@Wezl Well, you could say that instead of doing f=foo.bar.baz and then having a command named f, you have a command named foo.bar.baz :P
 
@Anush That's probably not the reason
 
@Anush that's cuz forcing things like file I/O makes your challenge boring
 
^
There's a reason most challenges use the standard I/O rules
 
@Anush What challenge was this?
 
7:32 PM
the reason isn't "golfing languages don't support it"
 
@RedwolfPrograms it is the reason I am given
 
it's "it doesn't add anything / makes it worse"
 
Because we don't really care that much about languages not being able to do something, but it's often boring that way
 
it's "there's almost never any reason to require it at all"
 
@user I often suggest a challenge I might do and am told not to because of this reason
 
7:32 PM
example?
 
Fastest code challenges are often practically impossible to do with golflangs. Doesn't mean people shouldn't post them
 
@user I also like those :)
@user sure but a golf challenge I mean
 
^^^^ I'd like an example too
 
the only interesting weakness of golflangs i can think of is internet stuff but i don't see any of that getting shot down
 
we discourage challenges that restrict languages arbitrarily
 
7:33 PM
@user boring seems to be defined partly based on what the golfing languages can already do
 
if a challenge is interesting but as a byproduct of its nature, causes some languages to be unable to compete, nobody cares
 
Not really
 
@hyper-neutrino right but that seems to be defined partly based on what the golfing languages can already do
 
@Anush No, they're just optimized for what's common and interesting
 
@EliteDaMyth Sure, go ahead if you want. But it can remove some of the fun :-)
 
7:34 PM
example: "am I connected to the internet?" blocks brainfuck and a bunch of other esolangs/golfing langs and it was a good challenge
 
If a challenge makes you parse input given in some arbitrary format, that's boring. If it's simply hard, that's not necessarily boring
 
@Anush it really isn't
 
Nobody likes boring and restrictive I/O, so it's not common, so it's not what golfing languages waste bytes on
 
 
I mean really a lot of golfing challenges are objectively not very interesting. They are just fun because the golfing language can do it
 
7:34 PM
conclusion: kebab-case is smart
 
again, I'd like an example of where you were told you couldn't do a challenge for the reason that golfing languages specifically cannot compete
 
That dash sure inflated HN's self esteem
 
@Wezl Hyper is like shrödingers cat, he is both smart and not smart until you look into his brain
 
@N3buchadnezzar you won't find much there
 
@hyper-neutrino anything involving file input/output
 
7:35 PM
I doubt that was the reason
 
@Anush Could you please provide an example of such a challenge? (something people said was boring)
 
That excludes languages as common as browser JS
 
@user it's hard as I am talking about chat.
 
That is more a problem with arbitary I/O restrictions that do not make the challenge more interesting
 
When a restrictive I/O requirement makes it so that two out of the top three languages on the site can't compete, maybe it's a bad idea
 
7:36 PM
well, what's the challenge?
 
8 hours ago, by Anush
CMC split a text file by lines into two files x% of the lines in file one and (100-x)% into file two.
 
I for example regard golfing reading in a file, splitting it and outputting it as interesting
 
see ensuing conversation
 
@Anush Well, CMCs are meant to be mini, so if you have restrictive IO there, people are probably not going to like it. idk about boring though
 
but because golfing languages can't do it it is discourages
 
7:36 PM
@Anush But it's not; almost all of that is fluff for reading/writing to files, which is the most boring thing you could possibly write
 
but they could have one byte for this
 
Only the file part is discouraged
 

This didn't say "golfing languages" was the reason the challenge wouldn't be good as-is.

6 hours ago, 6 minutes total – 29 messages, 4 users, 0 stars

Bookmarked just now by hyper-neutrino

 
Why not simply use multiline strings?
 
@user how are you meant to test it then?
 
7:37 PM
???
 
by inputting a string???
 
Our standard I/O rules?
 
The same way you normally test it
 
also, the fun is implement something real in a golfed way
 
how do literally 99+% of challenges on this site get tested?
if you want a "write something to a file" challenge a) that's probably been done and b) that'd be fine because then the task is writing to a file
 
7:38 PM
@Anush I think most of us disagree with you there
 
at least for me :)
 
@Anush lol, we have challenges about identifying upside down goats :P
 
here you're taking a boring task and adding a boring restriction, that doesn't make the challenge itself actually interesting
 
@user that is fun too :)
there are lots of different people here and it's fine for a subset to enjoy a subset of things
@hyper-neutrino it's an important task that is interesting :)
 
@Anush problem is, it's pretty much just two completely separate things - 1) do file stuff; 2) do the actual splitting
 
7:39 PM
seems pretty arbitrary to me
 
^^
 
especially if you shuffle the lines in the middle
 
Third attempt. Any suggestions or improvements before this goes live?
 
@Anush Then you should add that to the challenge and spice it up a bit
 
it's three challenges in one - read from a file, split it by something and output the percentage distribution, write to files
 
7:39 PM
@dzaima I guess only if the language doesn't accept standard in by default?
@hyper-neutrino a golfing language that accepts standard in can just ignore the first part
:58585685 i mean that could be zero extra bytes
the reading part I mean
 
wait what? so you're making a challenge but then arbitrarily allowing some languages to ignore part of the task?
 
yeah what
 
Why not just not have that in the first place?
 
Why not allow stdout for output while you're at it
 
@hyper-neutrino no. a golfing language that puts standard in into a default array for example will have no extra bytes for the reading part
 
7:41 PM
CMC: Print last posted message in The Nineteenth Byte when run
 
@RedwolfPrograms that's fine too
 
That's. What. Golfing. Languages. Do.
 
and we get back to where we started - we have standards for pretty much everything - input, output, randomness, submission format types, etc - why not just use them???
 
7:41 PM
@N3buchadnezzar only print last posted message?
 
why is the challenge stated in terms of file i/o
 
I'm sorry if it feels like we're bashing your ideas, but look at it from an answerer's perspective: they have to do three unrelated tasks, two of which (file I/O) are entirely unrelated
 
That's not reading from a file...that's just taking input.
 
@Wezl Only the last
 
@RedwolfPrograms ah so they do support standard in and standard out?
@RedwolfPrograms ok that's cool
 
7:42 PM
Their interpreters do, yes
 
I thought they didn't
 
@Anush Most do, yeah
 
@Anush yeah what gave you the impression that golfing languages don't
the majority of them use STDIO
 
@hyper-neutrino A misunderstanding :)
 
@hyper-neutrino I think they mean that some, like Husk, have an arguments section that's kinda sorta separate from STDIN
 
7:42 PM
jelly likes taking input from its command line arguments but it still has STDIN/STDOUT builtins easily available
 
And if you enforce the file based one, languages with JS interpreters can't compete
 
that is good
the only problem now is how to write two files
 
i mean, there are only a few sane ways to do I/O - stdio, arguments, files
 
@hyper-neutrino Pigeon
 
@N3buchadnezzar Python: s=':58585702 Python: `s=%r;print(s%%s)` *never posts a message in TNB ever again*';print(s%s) never posts a message in TNB ever again
 
7:43 PM
I guess it could be stdout and stderr if that makes things easier?
 
@hyper-neutrino Input from twitter
 
can they write to stdout and stderr?
 
Yes
 
Depends on the interpreter
 
stderr is also not supported by a lot of languages (not just golfing languages) but that'd be significantly better
 
7:44 PM
things are getting better :)
 
@Anush if you have to ask, the most likely answer is that there will be at least one language that can't
 
@pxeger squints
 
I don't get why you care so much about the details of the I/O
 
Golfing languages usually abstract away how I/O is taken
 
i mean, why not just output two things in some format?
like a list lol
 
7:44 PM
Isnt there a long emtapost on standard I/O?
 
@user I just like the idea that you are solving a real problem in a golfing way
 
There's defaults already made for this, all you need to do is figure out the meat of the challenge, and let the golfers input and output any way they want
 
107
Q: Default for Code Golf: Input/Output methods

Martin EnderIt looks like we have a consensus that we want certain defaults for the format which answers are expected in for code-golf. On that poll, the question arose twice, which input/output formats should be allowed for programs and functions. So here is another poll. This one works different though. A...

 
thanks for all the help
@hyper-neutrino thanks!
 
@Anush problem is, that's, by definition, boring :)
 
7:45 PM
@dzaima boring is in the eye of the beholder :)
 
@Anush There's a CGCC discord where you might be able to post this? idk
 
@user oh I had no idea! Are there more people there?
 
the thing about solving real problems in a golfing way is people are unlikely to solve the real problem
 
Yup, tons
 
unless you want like O(N!^N^17) solutions xD
 
7:46 PM
@hyper-neutrino sort of real problems :)
@hyper-neutrino :)
 
real problems with totally impractical solutions :P
 
idk about y'all, but I come here to get away from real problems
9
:P
 
:)
 
I think that many real problems can be interpreted as a series of coding golfs combined with some proper code review
 
7:56 PM
Did everyone leave to go talk on meta? lol
 
Hola
 
Anyways, since lack of feedback on the sandbox. And it has been left there 4 days, I'll post it and just deal with any unclearities
 
Man y'all are quick to diss my spelling :P
 
Just making sure :p
 
7:58 PM
you might as well describe the problem as, "given an array of integers and some sort of fraction, ratio or decimal, indicate (typically by splitting the array at that point) how the array can be split so that the sum of each half is as close to the fraction as possible"
 
Say you have 3x, +7, /5 and -2, what would be the best generall strategy to reach a generic 8 digit number in as few operations as possible?
 
Brute force using Jelly :P
Depending on your definition of best :P
 
1. Add 3x's until you have a 8 digit number
2. BFS ???
 
something like that
 
I was thinking that after adding all the 3x's you can reach your target if they are both even
@user I actually doubt you could bruteforce it in Jelly :p
And if you could, all it would take would be to instead use american phone numbers
 
8:03 PM
???
 
It would timeout
 
No, I meant your second message
 
American phone numbers are 11 digits, much harder to bruteforce than 8
 
I couldn't brute force it in Jelly anyway because I don't understand Jelly :P
 
I always bruteforce in Jelly
 
8:04 PM
That's typically the shortest way
 
I just try random combinations of letters until something compiles
 
@N3buchadnezzar They're 10 afaik, but why are you bruteforcing them?
 
Bruteforce as in attempt to reach from 0 using only 3x, +7, /5 and -2
 
But why?
 
Why not?
 
8:06 PM
@Anush CJam
And Jelly, if you count STDIN and STDOUT as files :P
 
I'd argue Jelly can read from files but not to files as it can take a filename as input (STDIN)
 
I really want to answer this question using a ridiculous amount of abstraction (a Couple class, a CoupleBuilder, the works), but I don't think the CR people would take that too kindly
 
@user I do that sometimes, it is not discouraged
Here is what you did, here is how it could be improved. Here is industry standard
Also it is not tagged beginner, which means "feel free to go ham"
 
@user Man, programmers are so bad at social interactions that they now need code to do it for them???
 
@N3buchadnezzar Well, the problem is that I don't know the industry standard :P
@cairdcoinheringaahing lol
 
8:13 PM
@user Then...
Then we pretend we know the industry standard
 
lmao
 
Surely that depends on the industry?
 
idk why I even answered any questions on CR in the first place
I have answers from last year when I myself was a novice, and I had the arrogance to tell other people they were doing stuff wrong lol
 
The best way to learn is to teach
 
@cairdcoinheringaahing I guess? gtg write 1000 lines of code bye
 
8:16 PM
@user CMC: Given a list of pairs of strings [a,b], "introduce" each string to every string in the list aside from the pair by printing x, this is y. For example, the output for [["Michael", "Sandy"], ["Frank", "Claudia"], ["Andrew", "Michelle"]] would be:
Michael, this is Frank.
Michael, this is Claudia.
Michael, this is Andrew.
Michael, this is Michelle.
Sandy, this is Frank.
Sandy, this is Claudia.
Sandy, this is Andrew.
Sandy, this is Michelle.
Frank, this is Andrew.
Frank, this is Michelle.
Claudia, this is Andrew.
Claudia, this is Michelle.
 
val couples = arrayOf(
    arrayOf("Michael", "Sandy"),
    arrayOf("Frank", "Claudia"),
    arrayOf("Andrew", "Michelle")
)

for (i in 0 until couples.size) {
    for (j in 0 until couples[0].size) {
        var currentPerson = couples[i][j]

        for (k in i + 1 until couples.size) {
           for (l in 0 until couples[0].size) {
               println("$currentPerson, this is ${couples[k][l]}.")
           }
        }
     }
 }
Here, have an original Kotlin solution :P
 
Ugh, look at all those wasted bytes
 
It's also not very good code outside of code golf
Two of the loops are unnecessary, as is currentPerson
 
Yes, I am current person and I am unnecessary
 
@cairdcoinheringaahing 19 bytes in Jelly
 
8:22 PM
assuming order doesn't matter, Jelly, 25 bytes: Œcp/€Ẏj€“, this is ”;€”.Y
feel like the string manipulation is really bad there tho
 
Whoops, forgot about the trailing .
22 bytes then
 
wait you only need 3 bytes to add the period?
huh
 
ah that's smart
 
the classic
 
8:24 PM
so it wasn't the string formatting :p
 
While testing, I had Ç+/€€€ŒṘ at one point, and kept having to adjust the s :P
 
wait tf
 
8:26 PM
ah that makes sense
 
I always forget that p”<char> only works for the smashed output :P
 
i accidentally submitted an incorrect edit (to be approved) can i somehow edit it? or delete it to submit a new one?
 
Was it the latex one?
 
yes
 
I just improved the edit to fix the * -> \times
You should still get the +2 from it
 
8:36 PM
he meant number of covered unit squares * 2 + 3
i thought he meant x as a variable
 
@EliteDaMyth Feel free to submit another edit :P
 
Aaahhh, they only need to greet once right? if x has greeted y than that is fine no need for y to then greet x
 
@cairdcoinheringaahing done :)
 
Now to wait for the review queues to catch up :P
 
8:43 PM
CMC: Take a positive integer (like 72331), take its digits, take the exponent by the index, and add them together (like 7^1 + 2^2 + 3^3 + 3^4 + 1^5 = 120)
 
Can we take input as a list of digits?
3 bytes if so in Jelly, otherwise 5
 
i think i have the same two as yours, 3 for digits, 5 for number as well
oh i should add an MD5 button to my TIO interface
 
I doubt there's really any other way to do it :P
 
yeah :p
well you could do the monke brain solution i initially had
DĖ*@/€S
 
8:46 PM
:p
 
yep, i had your first and third sol :p
 
Finally this works .p Try it online!
No golfing in sight, this is the handshaking problem. But I did not bother looking up a proper algorithm for it
 

« first day (3815 days earlier)      last day (1031 days later) »