00:00 - 16:0016:00 - 00:00

12:02 AM
@Zacharý if it were ltr, you would be able to use -⍨/
@Zacharý apl is unparsable

1 2 3 a 4 5 6 could be multiple different things

@Dennis O_o

Operators ...

I wonder how long Charcoal would take to do that (it would probably time out. plus I don't think there's a way to easily instantiate a Rational yet.)

@ASCII-only reminds me of the brain-flak quine

12:10 AM
Is -⍨ in LTR equivalent to - in RTL? That doesn't seem right...

@Zacharý up to a sign

Ah, I see...

for -/ at least

Finally, all tests pass again >_> (read: time to prepare for tests for fail for another few days)

@Zacharý was that a response to my comment that apl is unparsable?

12:17 AM
The worst part about right-associative scan is that it requires a separate computation for each prefix. Unless the interpreter can figure out that the function is associative

@H.PWiz yeah, it's O(n^2) for user-defined functions

What's the most bountied answer on SE?
There's a SciFi.SE answer that's at +3850 from bounties (and that also happens to be the sole post of the user on the site), and I haven't seen anything more than that

@ASCII-only C takes 0.035 seconds with GMP.

@Dennis As a rational?

Yes.
Takes slightly longer on TIO, because it counts compilation time. tio.run/##RU7LCoMwEDwnX7FYChG11F61/YXSe0Ek0XQhiY/EU/…

12:32 AM
Haskell has it at 1 second

Nice! Python 3 + gmpy2 gets it in 0.060 seconds. tio.run/…

Surprising
gmpy2 must be pretty heavy C

It's supposed to be a very thin wrapper around GMP and MPFR.

Looks like GHC uses gmp. The slowness probably comes down to rationals being defined inside of Haskell

Heck, import sympy takes 100 times longer that computing the sum with gmpy2.

12:37 AM
(code)

@EsolangingFruit probably the branch prediction fail answer

@EsolangingFruit If you include all 6 of them as one answer, then it's QFT

@H.PWiz Try -O3.

Right, I was only providing the code

12:39 AM
Huh that's only at 1550

@Dennis O_o I should probably switch Charcoal to gmpy2

What is it using now?

Python >_>

@Zacharý tio.run/##S85JTcz7/z83P6U0J1UhNzEzjysztyC/… - in Clean, ofc Haskell can do it too, so can others.

Probably the built in fractions module then

12:42 AM
> x.denomintor
how has this not been fixed yet D:
How fast is mpz compared to Python's int? nvm they say in the wiki page
@quartata Charcoal? No, it's using pure Python int arithmetic >_>

you mean you wrote the rational code yourself?

Yes. And it's not very fast, nor does it contain anything resembling good code

Rational code is easy to do.
So your rational code isn't RATIONAL?

1

We have many challenges based on base 10, base 2, base 36, or even base -10, but what about all the other rational bases? Task Given an integer in base 10 and a rational base, return the integer in that base (as an array, string, etc.). Process It's difficult to imagine a rational base, so le...

@Zacharý not easy to do it fast

12:48 AM
Does anyone know if gmpy2 (or gmp)'s precision applies to integers, rationals and complex too?

@Zacharý Here we go: tio.run/…

there's a couple extensions for complex numbers
at least in C world

hang on never mind >_> I can just (somehow) cast to real

@HyperNeutrino why

12:52 AM
@Οurous because I can >:-D

@HyperNeutrino complex complex numbers are just complex numbers: (a+ib) + i(c+id) = (a-d) + i(b+c)

@ngn nope. a complex number in C++'s complex library is defined as a pair of numbers with the operations overloaded
complex complex numbers should be complex numbers but they aren't in this implementation/meaning of the term

@HyperNeutrino Yeah, instead they're complicated numbers.

wtf c++

12:58 AM
basically (a, b) + (c, d) := (a + c, b + d)

so complex numbers are just twoples in c++

(a, b) * (c, d) = (ac - bd, ad + bc)
(a, b) / (c, d) = (a, b) * (c, -d) / (c^2 + d^2)
-(a, b) = (-a, -b)
etc, you get the point
it doesn't matter what a, b, c, d are, just that they support those operations
because C++ doesn't support restricted template arguments (IIRC) so you can put anything in there, it's just that it won't compile if it doesn't support the required methods/fields/operations

@DJMcMayhem I don't.
@quartata That's at +1550. The answer I mentioned is more than double that.

@HyperNeutrino I have a feeling we've had this conversation before...

@Zacharý I have with you before :D

1:17 AM
@EsolangingFruit :/ There's no easy way to find total bounty for a question

@HyperNeutrino you use template traits for that
you're right though in that it's all dependent on SFINAE

I'm not sure why a 2D language needs a builtin to read environment variables but now I have one.

My monitor is borked
It's like everything has a drop shadow to the right.
Does anyone know this problem?

@feersum Only if your monitor is a website and it has questionable CSS.

nvm pushing in the cable fixed it.

1:50 AM
@EsolangingFruit You're right

@ASCII-only Fixed

2:11 AM
Is there any disadvantage for using gmpy2 for all calculations?

It's slower for everything that could be done with native types.
To the processor, not Python. 64-bit ints will be faster than gmpy2.mpz.

Anonymous
gmpy2 will be slower than Python regardless - the extra cost of running a non-native library will make it slower than just using Python's longs

Anonymous
The Python runtime -> gmpy2 -> gmpy transitions alone will be quite costly

2:32 AM
@Mego Wait, but gmpy2 said it's faster for calculations > 20-50 digits :/
@Dennis But would it be faster than switching between Python and gmpy2 depending on the calculation?

It depends on what you're doing. If you're going to sum a huge amount of different integers, the cost of typecasting will be higher than the save in computation time. If you have a small amount of integers you're performing expensive calculations on, gmpy2 will be much faster.

Anonymous
@ASCII-only True... It's reasonable that, for some length, the extra cost of running native gmp code from Python is less than the cost of performing the same calculations with Python's longs

@Dennis What if you directly translate from source code (string) to e.g. mpz?
Or do you mean a huge amount of numbers with different GMP types?

Things like sum(map(mpz, range(10 ** 8))) must absolutely be avoided.
Even sum(range(10 ** 8), mpz(0)) is way too slow.

2:47 AM
@Dennis oh, ranges :/

But if you don't typecast all the time, the performance difference is less. tio.run/##bY49DsIwDIX3nMJbEtEhhQ3oFXoIpJRGwnEUGaH28sFtUwQSHvzz/…
Actually, that's not quite fair because of the import.
Better. tio.run/…

Hmm so basically avoid unnecessary instantiation

ok so, what if i wanted to interact with a list, but it's in a nested list, and i want to use an integer to represent how nested it is?

@DestructibleLemon what exactly do you mean by that, example?

so, i'm parsing bf
if i come across a [, i start a new list

2:55 AM
@DestructibleLemon why can't you just use an integer

if there have been 5 [ so far, and no ], that means that program[-1][-1][-1][-1][-1] is a list that is being edited with the commands inside the loop
obviously that looks ugly as frick
and also not arbitrary

every time you recurse just add call_stack[-1][-1] to the call stack and when you unrecurse then del call_stack[-1]

@DestructibleLemon well yeah but you're never actually going to type program[-1][-1][-1][-1][-1]

i guess i could use repeated assignment of like, for i in range(thingy): current_program = current_program[-1] but that looks rather inelegant somehow
@ASCII-only exactly, which is why i need to know how to use an integer for this task

@DestructibleLemon why?

2:58 AM
g = lambda a, r: g(a[-1], r - 1) if r else a
send code please? this is not a good way of doing this

just use a list of indices as IP

@ASCII-only because i can't type [-1][-1] and i feel like there should be a not hacky way of doing this

send code @destructible I'm pretty sure there's a way better way of doing what you're trying to do

i've written like nothing
tape = [0]
program_string = input("input program")
parsing = True
program = []
while parsing:
which gives a syntax error because i haven't written any of the actual parser

you don't really need to parse BF, you can just interpret it. why do you need to parse it?

3:01 AM
parse it into an easier to interpret state?

ok makes sense I guess
so how should the parse tree for ,+++[>++<-]>. look

@DestructibleLemon well of course you can't type [-1][-1], you don't know there's a list there
,+++
>++<-
>.
@HyperNeutrino

ok makes sense
still don't see why that's necessary because it will recursion error way sooner than regular interpretation will, but okay

otherwise, loops are a huge PITA
@HyperNeutrino no?

yes...?

3:04 AM
wait a second, i wrote a bf interpreter before, i can just look at that one and copy it with minor modifications

@HyperNeutrino you're just pre-extracting the loops so you won't spend O(length(code)) time looking for the matching bracket?
@DestructibleLemon ...

copy paste
the requirements i have for the new interpreter are a bit different though

@ASCII-only yes but it will still recursion-error earlier, potentially. actually if you implement it correctly it won't so never mind ignore me ಠ_ಠ
also you won't have 1000 nested loops

so it makes sense i need a new one

0

Lead or Follow answer-chaining descision-problem restricted-source In this challenge you are to write a program or function, that takes a string as input and outputs one of two possible values. For an answer to be valid it must meet three additional criteria When you pass your program to its...

3:05 AM
yeah i just used the recursive approach to parsing in the old one
rather than the iterative one that i was thinking of using this time...

@HyperNeutrino I did it this way with UGL

should i include randomness in this dialect?
because it's the dialect i'm using for the compiler challenge

@HyperNeutrino yes >_>

o ok

@HyperNeutrino nice 10/10

3:08 AM
ty
Golfed to 106 bytes:
p=input()
P=[]
s=[P]
for c in p:
if c<"[":s[-1]+=[c]
elif c>"[":s=s[:-1]
else:s[-1]+=[[]];s+=s[-1][-1:]

@HyperNeutrino 6/10 abuses confusing reference equality

@DestructibleLemon lol well I mean it makes perfect sense to me but I guess it is confusing

it took me like 5 minutes or something to figure out what was happening

oh lol
more confusing than I expected, I guess :P

i know how it could be less confusing
wait actually it's not very elegant
alright so... i think i saw some sort of list indexing/slicing notation that included ,
was that a dream or was that real

3:17 AM
@DestructibleLemon That's used by some third-party Python libraries. Also Pytek.

I just saw a guy digging through every single mailbox on my street and I can't help but wonder who the hell tries to steal mail on Sunday.

LLVM is backed by companies with total worths of over a trillion USD. It was developed by apple and yet their website still looks like: llvm.org

@ASCII-only what actually is the syntax?

@Downgoat that is a very beautiful website

It's really basic but it's not actually bad

Anonymous
3:18 AM
@DestructibleLemon numpy uses "extended" slicing. It's just regular slicing with __getitem__, but it works with tuple arguments

I mean it probably loads very quickly if routed through TOR because of the simplicity in its design :P

oh ok

Anonymous
@Downgoat Useful > pretty. See: gcc.gnu.org

@destructible tio.run/…

alright, now i'm going to do a good old copy paste of the program i made a while ago and then modify to be arbitrary cell size

3:19 AM
why are we getting flooded with off-topic questions

also should i include randomness in it? i think i won't because it's likely that there are similar bf interpreters, but not ones that will likely have randomness.

0

Let $A,B \in \mathcal{M}_{n,n}(\mathcal{F})$ be such that $AB = BA$ and let $\lambda$ be an eigenvalue of $A$ with eigenvector $\vec{v}$. Prove the following: For all $m \in \mathbb{N}$ and $a_0, a_1, ..., a_m \in \mathcal{F}, a_m\lambda_m + a_{m-1}\lambda_{m-1} + ... + a_1\lambda + a_0$ is an...

0

I am currently trying to solve this problem Some gave me a hint: this problem is equivalent to a certain "matrix multiplication" using min/max and '+' instead of '+' and '*' respectively. Then you need to compute a matrix power. However, after thinking about this problem 2 hours, I still have ...

Anonymous
@HyperNeutrino Finals in some parts of the world

oh I see
> My final exam is coming up and I am panicking
oh I didn't see that :P
is there a site policy about ongoing external contests?

well, the first modification i have made is that now it reads end of line newlines as 10 instead of 0

Anonymous
3:24 AM
@HyperNeutrino Assuming no copyright infringement issues, there is no firm policy other than "use your best judgment". We don't want to compromise the integrity of external contests, but we also don't want to turn away valid challenges.

hm okay. I see

Also CS exam questions are pretty trivial at least the AP CS one I took
the hardest problem was "convert 1d array into 2d array with row size N"

wow so difficult lambda a, n: [a[i * n:i * n+n] for i in range(len(a) // n] :P

@HyperNeutrino @DestructibleLemon this took way too long:

Anonymous
@WheatWizard In addition to what I said in my comment, my script has Stack Overflow hardcoded :P

3:28 AM
Fair enough

@ASCII-only why do you only have limited cells

@DestructibleLemon because it's easier :P
It isn't hard to change it to infinite though

yeah i seem to have been able to just delete a %256 in my program, so it now complies, except i need to get rid of randomness
ps. mine is more efficient
newlines are read as 0, because i didn't realise that that might be better than considering it end of line
it's called interbf because it has interactive i/o

@ascii tio.run/…

mine stores contiguous runs of the commands <>-+ as a list of effects
like +1 to cell 2 to the left, and -5 cell 7 to the right
hence it is more efficient
take that

3:34 AM
@HyperNeutrino oh yeah that's much better

i should probably add the ability to deal with EOF
how is EOF communicated on tio?

@DestructibleLemon well those are basically useless compared to the optimizations bfo makes

what does bfo do?

optimize loops, collapse runs of commands (into one) (this includes opposite commands, e.g. <> is removed), idk what else
Not sure, but it might recognize simple polynomials or something

@ASCII-only mine does all of those except the first?
actually was that only 2 things listed?

3:37 AM
@DestructibleLemon what does yours do to >>>><<><<>

Anonymous
@DestructibleLemon The same way as any Linux system - read() returns 0, and getchar() returns -1

@DestructibleLemon esolangs.org/wiki/BFO

uh, it takes the sum of the movement, and goes there each time
@Mego so how would that work for a python interpreter?

@DestructibleLemon ...the same way you detect EOF in Python normally?

i haven't done that before

3:39 AM
@DestructibleLemon EOF is met if std.stdin.read(1) returns ""
You can just do input_string = input_source.read() to read the whole thing

i'm using input() though

well that will error if you're at EOF

Anonymous
@DestructibleLemon input() raises EOFError

@Mego ok thx
i forgot

if you want to care about whether or not it's EOF, don't use input()

3:40 AM
i put it earlier
9 mins ago, by Destructible Lemon
the one i made a while ago: https://github.com/Compiler-Chain/Compiler-chain/blob/master/InterBF.py

Anonymous
input_lines = []
try:
while True:
input_lines.append(input())
except EOFError:
pass

# do stuff here

Anonymous
Alternatively: input_lines = sys.stdin.read().splitlines()

wait splitlines is a function? ಠ_ಠ i always just did .split("\n")

i made it just do input = chr(0) like how bf uses 0 = eof
@HyperNeutrino yeah me too

I mean it's golfier but like I trust splitlines has some advantage (maybe supporting stuff like \r\f)

3:43 AM
yeah but who cares about windows newlines

Anonymous
splitlines() splits on (\r?\n)|\r

Anonymous
i.e. \r, \n, or \r\n

Anonymous
@DestructibleLemon It's also the standard for HTTP according to RFC2616

what
why
nasty

@DestructibleLemon People who use windows.

Anonymous
3:45 AM
I dunno, but it's the standard

@ASCII-only bfo actually only optimises for length though

but are you sure having a standard that standards should have standards would follow the standard of standards?

it isn't an optimised interpreter really

Anonymous
Probably for compatibility: by matching \r?\n, you can match both styles of line endings very easily. The standard says use \r\n, but applications should be able to handle \n.

3:47 AM
there should really be a regex operator to do a or b or both

Anonymous
\r\n doesn't affect \n systems at all, but \n makes stuff unreadable on \r\n systems

so you don't have to do a?b|a

that said, mine doesn't optimise double brackets though, but at the same time that's not super necessary

@HyperNeutrino or both implies ba is also allowed

@DestructibleLemon this maybe?

3:48 AM
@Pavel (a or b or ab in that case :P)

@ASCII-only maybe
probably
ok so apparently the speed optimiser doesn't work when there are non-command characters
better fix that
well it did work, but not as well as it could and the fixing was quick
should i use a minimal version or a more complicated version of the language for this challenge?

4:13 AM
wait apparently it did work with non-command characters because it stripped them out earlier
either way, i haven't downgraded it significantly, and i'd say it's clearer now

4:26 AM
i have a weird thing where i'll procrastinate on things because i really don't want to do it because it's boring (and sometimes seemingly pointless) and then randomly out of nowhere i will find it tolerable/enjoyable and then do it and finish it at the exact right moment that I finish it comfortably on-time (without being last-minute)
anyone else get that or am i just weird

@HyperNeutrino how can you finish exactly on time without it being last minute

as in I finish it the night before but not at like 3am
so i guess not "exactly on time"

I would call that comfortably on time

sure, that makes more sense

2 hours later…
6:02 AM
@HyperNeutrino the superpowered Studentman

@DestructibleLemon student and man usually don't go together

Studentboy?

6:32 AM
That's quite a bit better, I guess?
Also: improving Charcoal's deverbosifier is harder than I though >_>

I think i finished the quarterstaff parser

why is it called quarterstaff

uh, because it's simplistic?
and like a quarterstaff it does not have function calls

6:56 AM
That's technically true

7:07 AM
@Pavel k, 10 bytes: {(0N;x)#y}

7:37 AM
@Adám you can unswap the comma

... I am disappointed in Quora
I have a math thing that I decided to post to Quora instead of Math.SE to see if people there are competent
oh well going to Math.SE now

@ngn Yes, of course.

7:55 AM
@Adám and here's a weird 9-byter: ⍉|∘⍳∘≢⊢⌸⊢

8:13 AM
0

Task Encode a string that entirely consists of uppercase alphabets (A-Z) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple! Rules Your program/function must correctly handle any valid input string of length 8. The results must have the same length for a...

8:30 AM
0

I was given a question to implement a data structure that counts items. So here' the puzzle: The data structure has several methods and all must support O(1) average time complexity. Methods: increment(item) - increment counter for that item. getCount(item) - The overall count for that item (h...

@ngn With emphasis on weird. :-D

8:47 AM
1

Challenge: Given a string only containing upper- and/or lowercase letters (whichever you prefer), put tape horizontally to fix it. We do this by checking the difference of two adjacent letters in the alphabet (ignoring wrap-around and only going forward), and filling the space with as much TAPE/...

9:04 AM
0

Write a program that can be run in at least two languages. It should output the running language name, and optionally language version (see below). There may be an arbitrary amount of white spaces (spaces, tabs and newlines) before and after the language name. Case independent but there should n...

9:44 AM
hi all

hello

what browser

hi @ngn

@Lembik late, but hello :p

hi @labela--gotoa :)

10:04 AM
@HyperNeutrino yes?
@HyperNeutrino you're doing something wrong then

I believe i have finished implementing my language quarterstaff
wait now i have i think...
actually just going to do misc bugfixes

10:27 AM
1

Usually the format for writing titles is similar to this: C, 3 2 bytes C, 10 8 7 6 4 3 2 bytes This format is not really readable, especially when golfs happened several times in a row. Also, this created the infamous "Crossed out 44 is still regular 44 ;(" meme, which is frowned upon....

what the frick...

10:44 AM
oh the program was working but 65-45 != 10 haha

Who uninstalled Skynet from NMP

0

Inspired by both the challenge "Unique is Cheap" by @Laikoni, where the score is based on the challenge itself, as well as the JavaScript (ES6) answer of @ETHproductions for the "Palindrome Compression" challenge, where he uses a pretty cool compression method for the palindrome-flag, upper/lower...

@ngn thanks
@ngn if you had the energy/time to explain the algorithm I would be very grateful

11:03 AM
@Lembik So ngn implemented it in C?

@user202729 apparently!
but it's not written in a tutorial style, let's say :)
I can test how fast it is in about 9 hours from now

I'm trying to figure out grep; why doesn't echo -e "hel42lo\nworld123" | grep '[0-9]+' work?

0

Note: There are some rude words in this question. There's an implicit puzzle in posed in this classic Monty Python sketch (you can also ready the script online). Various words are described as being 'woody' or 'tinny', and one is described as being 'PVC'. Here is a list of woody words: Gorn...

11:34 AM
@totallyhuman That's old, don't bring it up.

1 hour later…
12:43 PM
no clue how you'd count this

Anonymous
1:01 PM
@Adám The flaws with a challenge are not always immediately obvious

1:11 PM
@Mego Sounds like some Zen wisdom.

1:22 PM
@Pavel That's because there are three newlines, not too. Durr

@Downgoat I've encountered that before... Yes, make sure you have no file named main.swift in your project.
(Note that if a library you import uses main.swift, you've got to delete that)

Creating and solving challenges require very different skills.

1:37 PM
@StewieGriffin But trying to solve challenges forces into the mindset of the future reader. Doesn't matter if the potential challenge author is very good at solving problems.

But the user might not even enjoy solving problems.
As I said, I do understand your reasoning, but I don't like discouraging users from creating challenges.
My first post was a challenge by the way. I would not have liked if someone asked me to not post challenges until I've solved some myself.

Also IIRC Helka doesn't really solve problems?

@StewieGriffin Oh well, at least it is phrased as a personal recommendation.

If you only have a hammer, you tend to see every problem as a dupe.

1:55 PM

Anonymous
@StewieGriffin While some users may be able to write good challenges right off the bat, most new users we get do not. Answering challenges first is a good way to get experience with the site before trying to write a challenge. However, it's ultimately a recommendation, and not a mandate.

Anonymous
The same goes with the use of the Sandbox

@Adám I don't have a hammer, but most Stack Overflow problems are indeed a dupe.

2:11 PM
I've been trying to ''optimize'' my use of the jump drive in Stellaris to minimize the days taken for travel, but keep it above 120 days so the debuff wears off. I just realized that could be a awesome puzzle.

> I’m super excited to announce the first beta of React Apollo version 2.1. It is a non-breaking change (unless you are using TypeScript)
God damn it.

2:29 PM
@mınxomaτ What did they break
Like does the syntax not work anymore or did they just change some types

@Lembik sure, i'm not very good with words, but i'll try to

2:47 PM
bah, when did I pass 65536?

@ngn just pseudocode would be a great start

tfw your work building is running on half power

I was looking at Wunderground for the weather and I decided to make a table of the weather icons they use. jsfiddle.net/9mbjhnpf/13

3:03 PM
@Poke I feel you. Sometimes in my work building the ACs just stop working out of nowhere, or a whole room suddenly loses power.

@J.Sallé my docking station is only half working
one monitor, etc

@Poke wow that's weird
@mbomb007 what are the second/third icons? And the fifth icon on the last row?

@cairdcoinheringaahing Why doesn't this work?

can anyone get codegolf.stackexchange.com/a/157264/9206 to work in octave? For me it prints out the matrix and then a couple of minutes later quits

3:52 PM
@WheatWizard I would participate in a Prolog learning room if it were created
8

00:00 - 16:0016:00 - 00:00