« first day (4205 days earlier)      last day (645 days later) » 

12:02 AM
so perfectly divisible by 9, yet only 1 short of a perfect cube
 
1:00 AM
Sandbox posts last active a week ago: Get string from CIGAR and reference
 
1:26 AM
@Bubbler Only 5421 to go
 
1:47 AM
@Bubbler Wait no, only 1537 to go until a nice round number
 
 
2 hours later…
3:23 AM
CM(ega)C: Create a non-fungible esolang. That is, make an esolang that you can't make a fungeoid clone of.
 
Done
 
Can you explain what a "fungeoid clone" is?
 
2d language
@lyxal This exists
 
Its called unary
you can simply use up all Unicode codepoints
so there will be none left for extra instructions
 
3:35 AM
@Seggan add some directions and then you can move around a board of non-arrows, adding one to an accumulator for each character
 
How much can you change a language before it no longer counts as a clone?
 
I'm talking about esolang to funge relationships like Jelly -> Jellyfish
 
Is, e.g. Java non-fungible?
 
1 min ago, by Seggan
so there will be none left for extra instructions
UniUnary
only 1,111,998 characters
 
@lyxal make it in 3d :brain:
 
3:43 AM
o
 
4:21 AM
@lyxal Jelly
 
49 mins ago, by lyxal
I'm talking about esolang to funge relationships like Jelly -> Jellyfish
 
Is Jellyfish a fungeoid tho?
It's 2d, but that's about all it shares with befunge
 
i agree that "funge" is the wrong word for "2d language"
but its the only way to make the joke work lol
 
4:38 AM
@emanresuA it's inspired by ><>, which is inspired by Befunge, so I'd say yes
it's indirectly a fungeoid in a sense
 
5:12 AM
0
A: Sandbox for Proposed Challenges

bigyihsuanImplement String Projection Given two strings: a string s and an alphabet a, implement string projection in the shortest code possible: $$\pi_a(s) = \begin{cases} \varepsilon \quad &\text{if} \, s=\varepsilon \, \text{the empty string} \\ \pi_a(t) \quad &\text{if} \, s=tc \ \text{and} \ c \noti...

 
 
2 hours later…
8:09 AM
A programmer: I know many languages, for instance

C++
Perl
Python
Go
Bash
Java

A code-golfer: I know many languages, for instance

Piet
Jelly
Brainfuck
><>
Jellyfish
Befunge

CGSE'ers:

We learn a new programming language every two weeks!
 
every two weeks for lyal and also one every month for lotm :P
 
well, yes
so 3 a month, good
 
8:38 AM
@NobodyNeedsNames Most regular programmers only consider themselves competent in two or three languages. For example, I'm confident with Python, JS/CSS/HTML and Typescript. I can write basic stuff in C although I'm not particularly good at it, and I'm trying to forget PHP.
 
how do u even go about forgetting a language, just not use it?
 
¯\_(ツ)_/¯
PHP is so horribly cursed
 
Cries in professional PHP developer
 
@emanresuA I forgot PHP once
 
good for you
 
8:46 AM
^
 
i forgot js but it's coming back to haunt me just from hanging out here too much
 
JS honestly isn't that bad
 
it's definitely not php bad
 
It has some cursed bits, but once you look past those it's actually quite civil
 
JS has some incredibly dumb features but they are easy enough to avoid if you know the language well enough
looking at you with statement
 
8:48 AM
and where it is insane it's at least systematically so
 
@mousetail That's at least deprecated
May 10 at 4:30, by emanresu A
> There is a theory that an finite number of monkeys pounding away randomly at an finite number of keyboards will eventually get a clean compile. The existence of the Standard PHP Library would seem to imply that this has already happened.
Apr 9 at 6:07, by caird coinheringaahing
617
Q: PHP expects T_PAAMAYIM_NEKUDOTAYIM?

Peter TurnerDoes anyone have a T_PAAMAYIM_NEKUDOTAYIM?

 
@emanresuA WTF
 
it's the classic
have you ever read php sadness
 
Mar 4 at 19:05, by Radvylf Programs
PHP is like Perl and JS were brothers, and one day Perl falls off a cliff and liquifies his brain. So the doctors saw JS's head off and superglue it to Perl's still-warm corpse, then wrap it in tinfoil and throw it on a high voltage grid transformer.
 
Mar 4 at 19:06, by Radvylf Programs
Perl, now PHP, gets up, unwraps the tinfoil, and stumbles over to an automotive shop, and proceeds to drink a gallon of antifreeze.
 
8:53 AM
I initially thought adding types to JS was a good idea to reduce bugs, but a while later I concluded that JS has gone too far to be typeable
 
Someone should invent C without types
only void* pointers nothing else
 
@Bubbler I honestly agree with this
Also I wish JS had operator overloading
 
@emanresuA Eh, people abuse it a ton in python. I sometimes with python didn't have it
 
Yes, but it's nice to be able to do vect1 == vect2 as opposed to vect1.equals(vect2)
 
true
 
 
3 hours later…
11:46 AM
@lyxal But Is It Art? works here (it's my standard counterexample when people make broad statements about all programming languages, so I can solve your challenge by reducing it to the problem of looking for a counterexample to "all programming languages can be made into a fungeoid")
you can't make the instruction pointer 2D because it has nothing remotely resembling an instruction pointer nor any plausible way to add one
 
11:57 AM
@lyxal Regenerate / Retina
 
12:27 PM
well that just begs for 2d regex again :P
acutally thatd be pretty funny, a big sprawling 2d retina-esque program
 
Retina does have an instruction pointer
in fact, even regex does if you view it as a nondeterministic imperative program rather than a declarative one
 
regexes are so weird to me sometimes like
when i look at deadcode's gexes and i read something about a stack being popped and im like
are we both talking about regex here
i forget which flavors are actually "regular" expressions and which ones have too many features lol
 
ever since regexes had subroutine calls added, they've had a call stack
the only actually-regular flavour I'm aware of off the top of my head is Rust regex
 
ah, wow
i only know js regex lol
 
(which you won't see in PPCG answers normally, because truly regular languages aren't powerful enough to solve most of the problems)
I think some regex flavours also have other sorts of stack nowadays? or it might just be counters
 
12:43 PM
Rust regex is certanly more limited but it can match some context free gramars I think
 
only the ones which happen to also be regular, I think – IIRC it's actually compiled into a state machine internally
 
1:08 PM
hey guys what's the technical/more accurate term for "single-width" unicode chars?
Because I'm trying to find a reliable way to filter characters that will align properly in explanations
and in a way that isn't just copy-paste into an answer box
 
CMC Given a list of 1000 numbers, find the largest (longest) subsequence that is monotonic (that is never goes down or never goes up).
 
@graffe Brachylog, 8 bytes: ⊇{<₁|>₁} Try it online!
 
@ais523 cool.. but is this for contiguous subsequences only?
 
err, oh you want ⊇{≤₁|≥₁} because equal elements are allowed, still same byte length
no, that's for discontiguous subsequences
 
what do you get for [1,3,2,4,3,1,4,6,5]?
 
1:18 PM
contiguous subsequences is much more difficult because Brachylog's builtin for that doesn't have an implied longest first
 
ooh it works
how does it work?
 
it's just a translation of the spec
 
is it using dynamic programming?
 
"subsequence, not necessarily contiguous", and because it's the first nondeterministic thing in the program, also sets the tiebreak, which in this case is "longest"
{|} "either one property or another"
 
ah I see
 
1:20 PM
≥₁ "nonstrictly descending", ≤₁ "nonstrictly ascending"
 
how long would it take for a list of length 1000?
 
the actual implementation is really stupid, it just checks all the possible subsequences in order from longest to shortest until it finds one that works :-)
 
:) I really want to see it on a list of length 1000 now
 
sometimes the implementation can optimise, but I don't think it does in this case
 
if you can make a list where the odd indices are increasing and the others are random that could be a good test
or just a random list will be good too
 
1:24 PM
CMC produce a list of length 1000 where the odd indexes are increasing and the even indexes are random (approximately-uniform from a set of at least 500 possibilities)
 
@ais523 here is a random list of ints bpa.st/PT3Q
 
based on how long the Brachylog program is taking, I think it's just trying to brute-force it
so, technically correct, but not actually useful for solving the problem
 
@ais523 here is the list according to your CMC bpa.st/SYDQ
 
well, the challenge is more to golf the program that produces the list
 
can you make a version that terminates for this size input?
 
1:27 PM
because I thought it was an interesting problem
 
A = [*range(1000)]
for i in range(500):
    A[2*i] = random.randint(1,500)
 
it feels like "longest increasing subsequence" should be doable in linear time
then you just run that algorithm on the list, and the list backwards, and see which is longer
 
that would be cool
 
it's definitely doable in quadratic time (which should be manageable for length 1000) – just scan the list from every possible starting point, and delete elements that don't set a new record
(or tie the existing record)
 
It's easily linear time though right? Since every 2 integers can either be increasing, decreasing or same
 
1:30 PM
the problem is working out where the starting point of the sequence is
 
def longest_sub_seq(arr):
    main_arr = []
    sub_arr = []
    n = len(arr)
    for ind in range(n):
        if ind < n - 1 and arr[ind] <= arr[ind+1]:
           sub_arr.append(arr[ind])
        else:
           sub_arr.append(arr[ind])
           main_arr.append(sub_arr)
           sub_arr = []
    return max(main_arr, key=len)
 
e.g. for [4,2,3,5] both [4,5] and [2,3,5] have to be considered
 
that's for increasing
what does copilot give you? :)
 
I don't have copilot
 
me neither
 
1:31 PM
and this strikes me as the sort of thing that copilot couldn't get right without violating copyright
 
can confirm
def longest_sub_seq(arr):
    if not arr:
        return 0
    dp = [1] * len(arr)
    for i in range(1, len(arr)):
        for j in range(0, i):
            if arr[i] > arr[j]:
                dp[i] = max(dp[i], dp[j] + 1)
    return max(dp)
That doesn't seem right
 
@ais523 It will always be a point where the direction changes right? Including neutral as a direction
 
is that copilot output?
 
@lyxal how come?
 
@mousetail yes, but the number of such points could be proportional to the length of the string
 
1:33 PM
Yes
 
@ais523 it is
 
I think there's a linear-time algorithm, but the naive algorithm is quadratic, and the linear-time algorithm will need to do something clever
 
There can be at most 2 sequences overlapping a given point
 
@ais523 I think the algo I gave is optimal
oh umm.. maybe not
seems broken :(
 
@graffe what output does it give for [8,6,3,4,7,1,2,9]?
 
1:35 PM
@graffe copilot seems to be returning a single integer instead of a list
 
@ais523 it seems to give the wrong output
 
actually it might be correct on that, but with lists with that sort of structure it isn't checking all possibilities
 
[3, 4, 7, 9] is optimal?
for the increasing version I mean
how about this?
def longest_increasing_subsequence_indices(seq):
    from bisect import bisect_right

    if len(seq) == 0:
        return seq

    # m[j] in iteration i is the last index of the increasing subsequence of seq[:i]
    # that ends with the lowest possible value while having length j
    m = [None] * len(seq)
    predecessor = [None] * len(seq)
    best_len = 0

    for i, item in enumerate(seq):
        j = bisect_right([seq[k] for k in m[:best_len]], item)
        m[j] = i
        predecessor[i] = m[j-1] if j > 0 else None
 
I think so, yes
 
and then run it on the reversed list too
I think O(n log n) time is optimal
 
1:38 PM
my previous comment was referring to the [3,4,7,9]
 
@ais523 cool
there is [8, 6, 3, 1] going down
 
This should run in O(1) right excludin the array copy:
```
def ls(seq):
   lo=0
   hi=0
   ma=[]
   pre=seq[0]
   for b,i in enumerate(seq):
       if i>pre:
           lo=b
       elif i<pre:
           hi=b
       ma=max(ma,seq[min(lo,hi):b],key=len)
       pre=i
   return ma

```
How do I indent
 
I expressed the quadratic algorithm in Brachylog, but it's too slow for TIO, and I just realised it's incorrect anyway
start each line with four spaces, no triple backticks
there's a button to add the spaces for you
 
@mousetail when you paste code into the window an option called "fixed font" or similar should appear. Click on that
 
thinking about it, I think even the dynamic programming algorithm is O(n²)
 
1:43 PM
@ais523 check the notes I just pasted
 
(and the naive quadratic algorithm is incorrect)
 
Anyway, my algo is O(n) right
 
there's a loop, how can it be O(1)
 
O(n) sorry
 
graffe's PDF says that n log n is the limit
and that naive dynamic programming is O(n²) (which I'd just concluded myself)
 
1:45 PM
Sorry I'm probably dumb but how is this O(n^2)?
 
en.wikipedia.org/wiki/… says the same thing
 
@mousetail it's probably wrong rather than quadratic
 
Oh NVM I was looking for only consecutive subsequences
That explains why it's hard
 
at least this goes some way to explaining why Brachylog uses the brute force O(2^n) algorithm :-)
 
@ais523 :)
 
1:53 PM
@user nah i shall throw glasses out the window after a couple of months
hopefully
i can still see without my glasses
also:
^ completed!
 
@PyGamer0 noob question: i see apply at odd/even indices, are there ways to apply at (decisionProblem(index)) indices?
i see @, is that it? :-)C
 
fwiw, Jelly is supposed to have a way to apply at decisionProblem(index) indexes but it is broken (or at least acts very oddly) – this usually ends up not mattering in practice though
 
fair enough :P
 
I think what Jelly's version does is to apply the thing you're applying to the entire list, but then merge it with the original list at only the given indices
so, e.g., "reverse at [1,5] (1-indexed)" on [1,2,3,4,5,6] would produce [6,2,3,4,2,6]
yep, just verified: Try it online!
 
2:42 PM
just... one... more...
 
Nice
I have like 300 more till gold or smth
270
 
@emanresuA same. i know java, kotlin, python, c++, bash, clojure, and c#, but i only consider myself "good" in java, kotlin, and python
 
Not C#?
 
ehh im so-so in c#
 
I wonder how many languages really old programmers feel comfortable with
 
2:50 PM
mostly use it for windows programming and unity
@user Fortran, Lisp, Forth, Algol :P
TIL
5
A: Shortest code to produce non-deterministic output

MakonedeNotepad, 1 keystroke F5 Pressing F5 inserts the time and date. For example: 12:00 AM 1/1/1970

o ty for the upvote whoever
 
@thejonymyster yes
@ais523 yeah...my language doesn't have that behaviour though
 
3:14 PM
0
A: Loopholes that are forbidden by default

SegganBuiltins in kolmogorov-complexity I know we don't like disallowing builtins, but IMO having a builtin in a kolmogorov-complexity challenge solve the entire thing is a bit too much. While it's be nice to add it as a side note, show off what your language can do!

 
alright i found this:
Jan 16 at 21:27, by user
[X] Description of what you tried (juic avocad for thirtee minut)
[X] Expected result (juic)
[X] The result you got (no juic)
 
Human brains suck. I mean, we only have ~7 words of RAM, our disk write speeds are on the order of hours, and our STDOUT speed is only about 3 words per second. Although our STDIN speed is a bit faster, as is our disk read speed, it still takes us a few seconds to calculate a 3 digit sum. If we go into multiplication and division, it will take us more than a minute to calculate a 3/2 digit division.
Our files also has a tendency to slowly disappear, and the disk is notorious for editing itself. We also have terrible multithreading support. Yet somehow, we can parallelize sock pairing, make accurate distance measurements from only two images, and perform 99.999% accurate image recognition at speeds orders of magnitude faster than a computer.
 
but keep in mind that it were those brains that made computers and calculus
 
Our OS allocates cores very efficiently when they are inactive, and when the brain is asleep, it takes the time to update our disk state. It took us decades to perfect programs that could beat humans at our favorite games. How about that?
@PyGamer0 argh did you have to cut in in the middle
 
3:40 PM
@PyGamer0 what does this have over just googling :?
@Seggan what langs have a builtin for an entire kc challenge?
 
@thejonymyster idk
@Seggan sorry :P
 
@PyGamer0 i still plan on making memorization flash cards :P
i think i still remember bobby tables is 327
the mnemonic isnt pretty though
 
4:26 PM
@thejonymyster i.e. fib or all integers
 
@Seggan I don't think you can talk about human brains using the same words as computers and get a good comparison. The two work quite differently
 
i know, but its funny :)
 
Sorry, I am incapable of processing humor. Also, unexpected closing ) on line 1
 
4:51 PM
@Seggan right but like who cares about those? we can just have more better challenges :P my point being that it doesnt seem relevant to have a default that only applies to like, two or three really simple challenges... sounds like the opposite of what defaults are for
also those are sequence challenges, not kc
itd be funny if a lang had a builtin f(n) -> A(n) on oeis lolol
 
thats kinda my annoyance
and yes, i did mean seq, will edit
 
right that makes a bit more sense
 
also apparently the positive integers are only #27 on oeis :P
#1 i dont understand
 
kc having a builtin answer problem would be wild
also oeis 4 is my personal favourite
 
5:06 PM
yeah just found it lol
 
ive actually submitted a few sequences to oeis but it was before i realized that base dependency was a thing T_T completely meaningless sequence
 
whats base dependency
 
i might be saying it weird but im talking abt when the properties of a sequence depend on the base the number is represented in
 
ah
i wanna stick 5 in the evolution but cant find a seq that starts with that
 
5:22 PM
@Seggan the evolution?
 
evolution of oeis
 
a seq that starts with 5?
Should be extremely easy to find lol
 
i means a000005
 
Oh
what's the depth?
aka number of terms it needs to start with
 
idk
tried looking but se search is not the best
 
5:27 PM
for depth 6, I found A181819, A101296, A286622, A305800, A124771, A299701, A333257, A334299, A001616, A293442, A327527, A106737, A103391... and a bunch more.
 
i meant posting #5, not going from 5
 
@Seggan I wonder what's the standard for "proficiency" in a language, too. Even in the languages I know best, I still look up stuff in the docs/Google/StackOverflow all the time.
 
Just because you have to use Google doesn't mean you don't know it well
 
@DLosc IMO proficiency is when i dont have to keep looking up the standard library anymore ;)
 
5:43 PM
I mean, I definitely still look up stuff about Python's standard library
 
i mean as in i pretty much memorized what the common things do
i.e. in java i dont have to look up HashSet anymore
 
@Steffan I know, which is why I wonder what does mean I know it well.
 
@Seggan I disagree, there are often things in the standard library that you don't even use often
But you should probably know the main things
 
lemme clarify
for example, i wouldnt call myself proficient in Clojure because i still have no idea what most methods are, how to efficiently iterate, various sequence methods, etc
 
yes
 
5:47 PM
proficiency is when you spend less than 70% of your time googling :P
 
something like that lol
 
Thinking about Python and SQL, both of which I'm fairly productive in, one description that comes to mind is that I know what's possible and generally know what command/function does it, but I may not always remember the exact details of how to use that command/function.
 
^
 
I would say I'm fairly proficient in JS, but sometimes I still find out about a new array method or something (though I know most of them)
 
Also I have very little idea how to write efficient code in any language. :P /hj
 
5:57 PM
Sometimes, I google something not because I couldn't do it myself, but because it's faster :P
For example, to get a Fisher-Yates shuffle
Why write it yourself when somebody else did it for you?
 
@DLosc Correction: Jellyfish's math operators auto-cast the result to the type of the first (south) argument. 'A + 1 is 'B, but 1 + 'A is 66.
 
@Steffan this
 
@DLosc Thus, 31 bytes
 
how can i interpret oeis.org/A001687? the formula does not give the sequence
i mean the formula a(n) = a(n-2) + a(n-5)
 
@DLosc 29 bytes
 
6:15 PM
@Seggan it overflows for anything other than 0, adding if n < 0 return 0 gives the wrong answer, using abs instead of 0 also gives wrong answer
 
CMC: Given a binary string, find the longest suffix which occurs in elsewhere in the string and doesn't overlap the suffix (you can assume exactly one will always exist). Find the next digit after said suffix, and append the opposite digit to the string.
Examples: `011` => `0110`, `100100` => `1001000`, `0011010110` => `00110101100`
 
@DLosc Oh goodness, I've been massively overthinking this. 19 bytes
@thejonymyster What should be the output for 0100? The longest suffix is 0, which has two previous occurrences with different next digits.
 
6:32 PM
idk thats why assume exactly one :P
i guess i could have phrased it better lol
 
Oh, I'm so used to seeing "assume at least one" that I misread :P
 
nice :)
i just remembered how i handled the issue in the domain i was working with it in
i wont change the cmc about it lol
 
I think it will work for 26 bytes without the ^, actually
 
but like i was trying to generate a non repeating decimal in a funny way, so it only mattered that the last two occurrences did something different than one another
so the rule was to base it off the second to last one (the non suffix one)
so in that context 0100 => 01001
 
For that behavior, my regex would have to be (.+).*?(?<=(.))\1
 
6:37 PM
also by "remembered" i mean i was looking through my notes again to find it lol
oh interesting difference
makes sense
 
 
1 hour later…
7:42 PM
@thejonymyster Is this... a tag system?
 
hell, maybe
 
I wonder if it's Turing-complete
 
i wondered the same thing lol, i hadnt considered using arbitrary starting points until today :P
i also wonder if every binary string appears if you repeat the process for some specific string(s)
or to get it to generate x0x00x000... forever :)
 
7:58 PM
@DLosc 30 bytes for a version that can handle multiple spaces in a row
 
8:24 PM
What does CMC stand for?
 
Chat Mini Challenge, usually
ninja'd
 
barely
i just wanted to grab the link lol
 
8:42 PM
yknow what isnt on that list? <language initial>MC
if anyone wants to add that rn please do but i gotta drive lol so ill do it later if no one else does
 
8:55 PM
I don't know how I didn't find that page earlier, huh
 
 
1 hour later…
10:19 PM
@UnrelatedString Think I should post this as my own answer?
 
...yeah probably
 
Oh you already saw it?
 
nope
but it's so different at that point that it's definitely your own beast
 
10:41 PM
Ok started up my BF bruteforcer, should see the result for A in a few decaminutes...
 
@UnrelatedString `repr(a)?
 
...good question
it seemed to work on the test harness before i removed it to fit the link but what the fuck
looks like it's somehow inheriting the a from the for loop in the test harness lmao
i love python scoping
 
@emanresuA What about it?
 
the lambda argument is x
 
Oh, weird that it worked
Okay, when I first post this, I'm going to use the 215, then wait 5 minutes and edit it. So it can be proper and all.
 
10:47 PM
👌
 

« first day (4205 days earlier)      last day (645 days later) »