« first day (4929 days earlier)      last day (210 days later) » 

00:05
I'm trying to design a language where all variables are global, and I'm having a hard time figuring out how to do recursive functions
def foo(x):
  if x == 0:
    return 0
  a = foo(x - 1)
  return bar(a, x)
Are there list variables?
There are lists, yes
If there are then you can basically just roll your own call stack
Unlike callee-saved registers in Assembly, functions here can't save variables elsewhere before their parameters are set
@UnrelatedString Oh right yeah
An immense pain to use but should work
Thanks
You're welcome!
00:07
If there aren't you can also roll your own call stack but it's much more annoying
I vaguely recall doing that for some kind of restricted-source Python impl of SKI calculus
How's that?
Arbitrary-length strings or arbitrary-precision bigints
(and pain and suffering)
Ah okay, abuse to turn them into lists
00:08
1
A: Minimal maximum byte for Turing Completeness

Unrelated StringPython 3, score 102 (f) def(): []=-1 Bubbler observes: With the known bound of m, [...] def is still available, but I doubt it will improve the score because I think making it Turing-complete necessitates the use of return. With awkward and careful use of implicit globals, we can do without ...

:D
I was just about to go look. Thanks
... wow that thing's cursed, I would upvote if I hadn't already
It really is (in a good way)
Now I'm trying to remember what the complication was that I ran into in trying to rely on implicit globals
01:08
Uncaught (in promise) SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Thanks javascript
I love having no way of telling which promise is getting bad data
1
A: Normal Subgroups of \$S_4\$

aeh5040Python 3, 0 bytes Items in identity order, to be concatenated and fed to the interpreter (only difference between them is in the last string literal): (lambda x=0:(lambda y:lambda z:print((lambda p:'I'if p in'123'else'K'if p in'032 301 210'else'A'if p in'231 312 203 320 013 130 021 102'else'S')(x...

This looks like cheating but whatever
There's a loophole for that somewhere
that still doesn't stop a 4 byte exec answer
yes, the 0 byter is invalid, but the open nature of the question is the real problem
Yes it does
strings aren't functions
01:21
Read the loophole
you cannot input complete or partial functions
where does that say strings?
"(lambda x=0:(lambda y:lambda z:print((lambda p:'I'if p in'123'else'K'if p in'032 301 210'else'A'if p in'231 312 203 320 013 130 021 102'else'S')(x()+y()+z())))if isinstance(x,type(lambda:0))else'0')()"
that's not a complete or partial function
that's a string
and I can exec it
"function" in that loophole is interpreted as basically any form of nontrivial code
> JavaScript, 4 bytes: eval - Input a program that generates a left-facing plane for left, and a program that generates a right-facing plane for right.
> What would prevent someone from having the fictional program run param where the param is a complete program when a truthy value is asked, or a different complete program when a falsey value is asked?
And in fact the examples there are taking a string of source code, not a (in-language) function
(not to mention that a few languages don't even distinguish them e.g. underload, golfscript)
@emanresuA no?
an objective reading applies it to only function objects
While I agree with the intent of this post, the wording needs work. 1, 0, l, and r are complete functions in Jelly. — Dennis May 8, 2018 at 15:17
so does that mean you can't take any input in Jelly?
Yes, there are edge cases, but this answer (and the examples given in the loophole) are pretty clearly violating it
I think as worded, if you stringified the inputs, it'd be somewhat untasteful to some people, but it'd be valid
@emanresuA besides, that's only a quote to support why the loophole should exist
not behaviour that's banned by the loophole
01:29
0
A: Sandbox for Proposed Challenges

shape warrior tIs there mutable aliasing in this list of variable references? decision-problem code-golf Rust's borrow checker enforces the requirement of "mutability XOR aliasing": a piece of data can either have multiple immutable references or a single mutable reference. This challenge revolves around implem...

honestly, I think the answer is clever, and a result of the challenge not being stricter on requiring only numbers for example
A lesson learned the hard way, honestly...
a) this is quite literally the exact situation the loophole was created to prevent b) the point of loopholes is that you can't "technically" your way around them.
the point of the loopholes is that you can't technically the question
if it was worded differently to exclude hyper-specific inputs, this wouldn't be a problem
but in its current state, a reasonable interpretation is function objects
because otherwise, like Dennis said, Jelly (and other languages) wouldn't be able to take inputs
and you can't be inconsistent in applying loopholes
otherwise you're saying answers are invalid purely because you don't like them
because you don't like the feel of them
I agree that the loophole isn't worded particularly well, but I do think "non-trivial source code in some form" is the best interpretation of "function". Otherwise you're disallowing languages like e.g. Flurry which have to take input as functions (church numerals)
01:44
7
A: What even is a "function" by our standards?

DowngoatA function is an independent routine which can perform I/O in some form. It is a section of code, which can be directly inserted into a program with no modification, and should be able to be assigned/named/referred to in some way. It should be able to run independent of surrounding code. It ...

not by site standards
> It should be able to run independent of surrounding code.
strings can't do that
> It should be able to take input/output in some form.
it's a string, how's it doing IO
That's quite clearly not the definition of "function" used in the loophole
I don't see any other definitions in the loophole
137
A: Loopholes that are forbidden by default

Martin EnderAdding input or rules which weren't explicitly mentioned in the challenge There was recently a case where an answerer claimed Nowhere does it say the program can't (also) ask the user what the [result] is. Adding additional input or new rules, because they haven't been explicitly forbidden...

that might be a better fit
but even then, there's no additional inputs, and freedom of input is allowed
01:59
@emanresuA and how do you determine non trivial source code? I could use #ambda instead of lambda and exec input.replace("#","l"). This new input isn't executable at all, and can't be used as source code
This is code golf. If a rule doesn't explicitly ban something, and there's a subjective interpretation required, there's going to be answers that take advantage of it
I'd still argue that falls under "partial", but you're right that there's no good place to draw the line
I would say this whole situation reflects on the question not being strict enough rather than the loopholes being lacking
The choice of input could have been subject to criteria such as any four numbers or any four single characters
You can have the strongest protections in the world, but if someone disables them, then those protections become useless
Also, when people choose custom input sets for "interpret this language" challenges, no one ever complains
Like when a language can be easily transpiled to the language used
Those would all be examples of strings acting as non trivial code, yet those never have any issues raised
If this were an answer in a golflang where the inputs where one byte or not as egregious looking, it'd probably be passed off as a clever boundary pushing answer
Based on my sampling, there are ~10+ questions with this sort of (partial) "any distinct values you want" I/O format. I don't think this should be something that challenge authors should have to specify, for two reasons:
- Strictly defining the sets of values that can be used runs counter to flexible I/O - we have I/O defaults so that challenge authors don't have to precisely specify this sort of thing.
- Even if a challenge did ^, it could still be exploited - for example, if limited to integers you could encode some program/output in the base-256 representation of said integer.
@lyxal That was exactly one challenge:
21
Q: Implement a simple stack language

RubenVergIn this challenge, you implement an interpreter for a simple stack-based programming language. Your language must provide the following instructions: push a positive number pop two numbers and push their sum pop two numbers and push their difference (second number - first number) pop a number an...

Which explicitly allows any language syntax you want so long as it has the required features (and has a "trivial eval answers" CW)
I feel like I've seen other challenges
@emanresuA but when you give an open choice, you should at least put some constraint on the open choice
(if you don't want that open choice abused)
02:15
As a challenge author, if I want to use this type of I/O but prevent this sort of thing I shouldn't have to say "32-bit signed ints, at most 2-char strings or an array of at most three values" every time. That's just a) nonsensical b) goes against flexible I/O defaults
If you've got three different data types I'd argue that your challenge definition could be simplified
There's nothing wrong with restricting to just one data type
I was referring to the "distinct, consistent values" I/O format
I am too
Simplify the distinct values to a tighter range
E.g only numbers
And let languages handle the numbers as needed according to number handling loopholes
@lyxal This is the only challenge that has freedom of I/O beyond "if your language has trouble with λ you can use \ instead" or "input can be separated by newlines or spaces"
@emanresuA okay fair on that one, but my other points about the loophole not explicitly mentioning strings, and the fact that it's a reflection on the challenge still stand
Hyper specific inputs are a potential problem, but I haven't seen anything concrete yet that bans them (and objectively bans them - not loopholes with wording that's open to debate)
The best thing to do at this stage is that if you feel an answer takes too many liberties, downvote it
02:22
And there isn't really any way to concretely ban them
Then expressing disapproval via downvotes is your only real viable option
Because there'll always be something technically valid
And technically valid is still valid
Yeah, I think we need a separate notion of "nontriviality", but it's not clear how we could coherently draw a hard line
Very much "you know it when you see it"
@lyxal But at the same time I think having it as policy we can point to somewhere is more desirable than just having an unwritten community standard
@UnrelatedString But if that standard doesn't flat out prevent abuse, then it's pointless
There are quite a few loopholes that are somewhat subjective, e.g:
22
A: Loopholes that are forbidden by default

Sara JUsing an inconsistent I/O format to encode information For example, for a hypothetical challenge where the output could only ever be two or eleven, submitting the python program lambda x:print"11" and claiming that it outputs in unary for certain inputs and in decimal for other inputs should not...

02:27
@lyxal Also barely related but I think we also should do away with a hard function ban since we waive it without hesitation for stuff like Church encoding in languages where there's nothing else
Though for consistent-values I/O we could restrict it the way we restrict other allowances for language limitations
Since simple functions in the place of simple non-function values seem like very much a gray area when it comes to nontriviality
And even simple non-function values are somewhat of a gray area - where do you draw the line on "simple"?
If you want a loophole name, "using distinct inputs to trivialise a challenge" could work
Like the abusing number types one
Ooh, that's a good one
It'd need to be a new loophole submission, but I think I could support something like that
It's still subjective and can be argued either way, but it does serve as discouragement
02:47
Yeah
Or maybe "offload work" rather than "trivialize", since putting half of your program's logic in the input format doesn't mean the other half is trivial
The same wording as the rule about not using weird number representations should suffice
03:20
I may have dodged a huge bullet entirely by accident...I was super mad at myself for not speaking up at my doctor's office when I broke my wrist to push for getting surgery on it (to make absolutely sure I'd have full range of motion), but turns out that would actually be much more likely to get me DQ'd from being a pilot
Ooooh
Yeah wow close one
04:06
I might have a plan
Dual degree with poli sci and ECE
hey guys do y'all see a staff badge on this account? stackoverflow.com/users/5190/vinko-vrsalovic
if you do, how close to California are you? (like relative)
I checked like six different science and engineering majors, and a BS in ECE would be the easiest to fit in with international relations and political science
@lyxal yes, and a couple states (so not too far)
interesting
there's potential caching problems is what's happening
for example, it doesn't show for me
@lyxal yes
you're in New Zealand, right?
04:13
and I'm pretty sure the nearest cdn is in australia
@lyxal I see a moderator badge; other side of the US but still in the US
any staff badge?
interesting
(the staff badge isn't a badge like that, it'd be next to the moderator badge next to the username)
04:26
so much for a geographical caching problem :p
Strangely enough I see only mod on MSE
Yeah that's been reported to be happening
(i may have unintentionally nerd sniped the teacher's lounge)
05:01
Just sent my advisor an email with the subject line:
> Thoughts/survival odds for 4-year plan
It includes the line "Do you think I would literally die if I tried to do this?"
And another banger, "[Two more classes. I currently have 03-231 in case I hit my head on something and decide to do pre-med, and 21-228 for some reason]"
what is my cat doing
She was sitting in my lap, then stood up, placed her paws on top of my head (such that her arms covered my whole face), and just kinda stood there
while sniffing my nose
Understandable
@RydwolfPrograms Honestly a good way to approach it
I feel way too stuffy when I talk with my advisor lol
..Also good on you for actually planning 4 years out
Wow
 
5 hours later…
09:46
0
Q: Find the newest element

aeh5040Given a finite sequence, each of its elements has a first occurrence. Your task is to output the symbol whose first occurrence is last in the sequence. If the elements represent posts and reposts of memes over time, we want to see the newest meme! Example Input: A-BANAL-BANANA-LAB A first occu...

I remember thinking of this challenge a few weeks ago, finding that 2-byte vyxal solution and dismissing the idea as "trivial"
@NewPosts @emanresuA CMC: return index instead.
That with a f-overdot tacked on the end
Mayyyybe there's a way to use uniquity mask but there's no way it's shorter
10:15
@emanresuA OK, I wasn't sure if it had that.
It's 2 bytes, maybe if it was 1 there'd be a shorter way
@Adám does ⊇⍸⍤≠ work? (vision)
Yeah.
@emanresuA How about index of last occurrence of first unique element.
Isn't "first unique element" just "first element"?
h=Tt I guess, there's probably a 3 (actually that specific version only works with char arrays)
@emanresuA Yes.
OK, how about last occurrence of last unique element?
10:22
That's a little trickier. There's no nice way to do "find last index" (or "find all indices") in Vyxal, so I guess for 5 Ut=Tt although there's got to be a shorter way
 
1 hour later…
11:23
@NewPosts what does undertale have to do with anything?
11:56
0
Q: Three up to 800 & sum to 2048

W D(flexibly) Output 3 random integers such that: Each number is 1 to 800 inclusive Their sum is 2048 Each valid possibility should be (hypothetically) equally likely. Unless explicitly designed otherwise, psuedorandom number generators in your language should be assumed to be uniform; for example...

 
6 hours later…
17:49
got my first non-trivial memory leak and I have no idea where to start to debug it
sometimes I forget why I usually don't do c++
@UnrelatedString Oh yeah, it was trying to use the *STACK, R = STACK pattern inside the definition for S
 
1 hour later…
19:14
@Adám lambda x:max(dict([*zip(x,range(len(x)))][::-1]).values()) for 56 in Python is what I get by beating Jonathan Allan's golf of matteo_c's solution into shape, but it turns out the other horror I just thought of actually beats it by 2
lambda s:[i for i,c in enumerate(s)if{c}-{*s[:i]}][-1]
...Actually not that horrific now that I've golfed it to use an if instead of another for :P
It WAS lambda s:[c for i in range(len(s))for c in{*s}-{*s[:i]}][-1]
For the original problem rather than index
 
3 hours later…
22:30
I just had to witness this code so now y'all do too
null!!
(for some context: !! in kotlin is the "assert not null" operator, so...)
@emanresuA ಠ⁠_⁠ಠ
wtf
Someone was very excited to have null
22:52
it's not entirely clear to me why not-null assertion is !! and not !
23:31
Because it's very exciting
0
Q: Rabinowitz-Wagon \$\pi\$ formula

alephalphaIn 1995, Stanley Rabinowitz and Stan Wagon found an interesting algorithm to generate the digits of \$\pi\$ one by one without storing the previous results. The algorithm is called the spigot algorithm. It is based on the following formula: $$ \pi = 2 \left(1 + \frac{1}{3} \left(1 + \frac{2}{5} \...


« first day (4929 days earlier)      last day (210 days later) »