« first day (3996 days earlier)      last day (1144 days later) » 

20:00
why do so many Apl symbols look like people
Examples:
⍢⍤⍥
@cairdcoinheringaahing Extra interesting, the case of the word doesn't matter, nor does the cases of each letter in that word
@pxeger late to the party, but I think -[1, 2] should be [2, 1] and -[1, 2] * -2 is therefore [2, 1, 2, 1] i.e. same as [1, 2] * 2.
do you mean [1, 2, 1, 2]?
@Neil oh that's a good point, it keeps the algebra working while also adding a nice logical feature
idea: programming language where math works like it should
20:05
the only problem being the backwards compatibility
i.e. "(" * -1 = ")"
@GingerIndustries isn't that what APL was supposed to be?
@cairdcoinheringaahing whoops
idea: programming language where math works like this: xkcd.com/2313
20:10
That's just any programming language :P
1 + 1 = 2
1 + "1" = "2"
"1" + 1 = "11"
"1.0" + "1.0" = "2.00"
= + "1" = "2.001"
0 / 2 = "("
[1, 2] / 2 = [[1], [2]]
[1, 2, 3] / 2 = [[1, 0.5], [0.5, 3]]
math
I love that there's a question on the HNQ which is just "Who is Kevin Bacon?"
I wonder why I titled it that?
although this remains the best clickbait I've ever seen probably anywhere on the internet
[1, 2, 3] * 2 = [1, 2, 3, 1, 2, 3]
@pxeger I bet its just a coincidence :P
20:19
2 * [1, 2, 3] = [1, 1, 2, 2, 3, 3]
@pxeger "Please delete the Nineteenth Byte" would've been good :P
[1, 2, 3][*2] = [2, 4, 6]
[1, 2, 3][*"2"] = ["11", "22", "33"]
@GingerIndustries TypeError: int is not iterable
@GingerIndustries TypeError: list indices must be int, not tuple
4 ** 2 = 16
4 *** 2 = 32
Presenting Mathyon: Where math works like it should
Welp, time to go change my name to Backets reamyappenzellpxeger Mar 23 '21 at 17:37
20:25
[1, 2, 3][[1, 1, 2]] = [1, 2, 6]
@DLosc excuse me
@DLosc @pxeger you still haven't followed up on this :P
can someone get @lyxal to do the GPT-3 thing again?
"Mathyon" is pronounced "May-yun"
And in England, its "Mathsyon" :P
@cairdcoinheringaahing I'd say this would be a good challenge idea but lookup tables so :/
brb
@cairdcoinheringaahing not to be confused with the surname Mathyson
20:30
CMC: Given a string that contains math as a substring, replace math with maths if the code is being run while in the UK :P
My proprietary programming language which legally can only be run from my computer in the UK: s->s.string::replace_all("math","$1s")
ladies, gentlemen, and people who don't give a fuck, may I introduce you to the worst piece of code I have ever written in my life: github.com/pxeger/whython/commit/…
Are you...looking at the file in which a function is?
No, the folder
Wow, that definitely won't be brittle at all
yep; in fact this is so hilariously horrible that I've decided to write a blog post about it lmao
May I ask why you need this? (or I guess the blog post will explain it anyway)
I'd appreciate it if you linked the blog post here if and when you write it, I'd like to cringe at and look down haughtily on your Python hacks
20:45
back
Because a[b] is slightly backwards-incompatible: because of PEP 585 type generics, when a and b are types, a[b] already does something
So overriding it to do function composition will break stuff
one second, if we're looking at stupid python code I need to go find something
@cairdcoinheringaahing oh, how did I not see that comment on my own post?
lol
I'm not just nominating people to give their rep regardless of what they want :P
I was assuming there'd be some context, but I wasn't expecting to have missed something that obvious lol
20:47
Observe the most ridiculous piece of Python code I have ever made:
return (list(_sources.keys())[list(_sources.values()).index(_sources[widget.get_parent().get_parent().get_parent().label.get_text()])], _sources[widget.get_parent().get_parent().get_parent().label.get_text()])
That is all one line
Clearly you have either not been coding for very long or you write very good code :P
Because if that's the most ridiculous piece of Python code you've ever written, you'd be horrified to see everyone else's
This was from around 2020
I tried to make it one line
@user it's up there
i'm going to look for others
If they're really bad, please be sure to also provide us with eyebleach afterwards :P
We've also got this function, from the same program (which is now defunct): github.com/GingerIndustries/newsstand/blob/…
A good for loop could make it a little better, but...wow
20:51
yea :/
and I'm not done yet
    if random.choice(range((monster.get("difficulty") + 1))) != 0:`
        damageTaken = random.randint(((monster.get("difficulty") ^ 2 ) + 1), (1 + (round(random.random() * 10 * monster.get("difficulty")))))`
Btw @pxeger are you accepting PRs for Python? I'd like to work on the assigning to constants "feature"
only had to edit it 6 times
assign = all_equal([name,strength,speed,skill,age]) and name == None
self.assigned = not assign

if assign:
    return None
Lovely bit of my old code :P
@pxeger speaking of which: can you maybe add some of those math functions from earlier?
@user sorry, but I don't think that feature really fits within my ahem Artistic Vision for Whython
20:57
:(
What about mvirt's automatic partials/currying one?
I want to add things which sound like a good idea, but end up being significantly less usable than expected
Ah, assigning to constants is kinda cursed from the start :(
@pxeger so my math functions
@user I'm not too sure on that either - it's too close to an all-round good feature
@pxeger 070 being an octal number.
And 081 also being an octal number (for backwards-compatibility with C).
20:58
@wizzwizz4 that was already the case in Python 2
@wizzwizz4 that might have too small an impact to be cursed; I'll consider it
lists have a __dict__ and assigning a non-numeric index assigns to the dictionary?
@pxeger Hmm, what about if it does the application in reverse? So if bar is a two-argument function, bar(1) would be the same as baz => bar(baz, 1) isntead of baz => bar(1, baz)
@GingerIndustries You do realise ^ is xor?
@emanresuA hm
I did not
that explains some things
21:01
@user maybe a bit too random
(So it's flipping the second bit of the number)
I'm looking for things that a new user with little language-design experience might suggest to Python
oic
so not totally obvious trash
but things that really are not a good fit for the language
Maybe allowing monkey-patching on builtin types?
I myself really wanted that when I was new to Python :P
21:03
Imagine if you took Raku's "just add everything" approach, and filtered it through a ISO C++ style committee but composed of high-school students
4
@pxeger TBH, I think your ? operator is the exact opposite: it doesn't sound like a good idea, but it's ended up significantly more usable than I expected
@user now that's more like it, although I'm not sure how easy it will be
Add <> as a synonym of !=
Depends on how it's compiled, probably not too easy
Unicode operators
21:04
But if it's simply a check somewhere that you can disable, very easy
@DLosc it was directly based on Ruby's inline rescue operator, which is definitely not recommend for real use
@emanresuA User-defined operators are a whole 'nother can of worms
@wizzwizz4 because Python 2 also had that, it's probably not interesting enough
But yeah, I could totally see user-defined operators being suggested for Python, but they're actually useful too :(
0
Q: Make an ed clone

12431234123412341234123ed is the standard text editor on Unix systems. Your goal is to write an ed clone. Task Write a programs that reads an input stream and after receiving a end of line character, print ? followed by a end of line character. The input has to be a stream. Such as stdin, a socket, UART / Serial input...

21:05
print was a useful keyword.
Why can't we use all functions as keywords?
A whole custom operator system would be interesting, and I have been looking into things like this for potential approaches
Like Nim?
or Ruby
You'd have to overhaul the Python parser for that.
Yeah :(
Ooh, UFCS like Nim would be nice. Basically, foo(bar, baz) = bar.foo(baz), foo.bar = bar(foo)
All these features are too hard to implement, though :(
21:07
Strict typing.
How easy/hard would it be to implement reversed indexing (index[array])
Wait, you can do that in vanilla python I think
No, that's annotations.
I tried to implement strict typing in pure Python once, and it crashed Python repeatedly.
I meant ^^^^
You can't do that in vanilla Python without subclassing int.
3[list] is impossible.
There isn't a __rindex__
21:10
But if you were able to do monkey patching on builtin types, then all sorts of wonderful things could be possible
i wish that were possible
You can do that already, with ctypes.
Let me find the code.
@pxeger Actual ranges (.. or -> operator or something)
26
A: Set a Read-Only Attribute in Python?

user4815162342Despite its dynamicity, Python does not allow monkey-patching built-in types such as file. It even prevents you to do so by modifying the __dict__ of such a type — the __dict__ property returns the dict wrapped in a read-only proxy, so both assignment to file.write and to file.__dict__['write'] f...

21:19
oh, i c
Personally, I prefer making the number 43 a string.
You have to avoid 44 if you do this, though.
> from forbiddenfruit import curse
Oh dear X^D
@DLosc \x1c
Actually – undefined variables are treated as strings.
Rationale: tkinter.
Instead of a NameError, you should just get the name you used as a string.
@wizzwizz4 I've definitely thought of making a language like that
One already exists.
You can assign to barewords in Perl?
Not sure, wouldn't surprise me tho
@wizzwizz4 File separator? Not sure what you mean
@DLosc bytes(map(operator.xor, b"X", b"D"))
@wizzwizz4 Ah, lol
Though, coming from a QBasic background, I'd say X^D really ought to be 1, unless X or D was already defined.
21:32
Why 1?
xor is essentially does not equal
X != D, so 1
Yeah, but it's bitwise.
@cairdcoinheringaahing No, ^ is exponentiation
(obviously :P)
Maybe ^ should be exponentiation for floats.
And undefined numeric variables default to 0
21:34
Or maybe it should XOR the floats' raw representations.
You should be able to do bitwise on floats
@cairdcoinheringaahing Doesn't look like it
Note to anyone overriding magic methods on Python types; you need to be a bit fancier than just altering the __dict__.
@DLosc No, I want it to be able :P
@wizzwizz4 Are you referring to Tcl?
21:43
@DLosc I was actually thinking of PHP. I should've said “many”, rather than “one”.
Oh, really? I've only ever seen $ variables in PHP, and I get an error when I try it without. Is that one of those php.ini settings?
@wizzwizz4 Barewords?
Kinda like strings but without quotes
Remember wat in Ruby where they had bare strings with method_missing or something?
@DLosc Don't worry, you can reverse() it ⍳]
@RedwolfPrograms Barewords, but assignable. Or, alternately, every variable is preinitialized to its own name as a string.
21:55
Challenge: print regex that checks the divisibility of input number
80
Q: Hard code golf: Regex for divisibility by 7

CharlesMatthias Goergens has a 25,604-character (down from the original 63,993-character) regex to match numbers divisible by 7, but that includes a lot of fluff: redundant parentheses, distribution (xx|xy|yx|yy rather than [xy]{2}) and other issues, though I'm sure a fresh start would be helpful in sav...

/^(.*)\1$/ works with unary input, right? (with the number of \1s being the number to check divisibility by)
> Challenge: print regex that checks the divisibility of input number
If you mean in decimal, I linked that challenge to show how difficult it is for 7, let alone higher primes
@pxeger This inspired me to search "butter" in the TNB transcript, and I discovered a huge conversation about peanut butter back in July 2015 that's really funny
21:59
decimal or binary.
@DLosc you kinda can set bare word vars in Perl and it supports barewords for anything undefined: Try it online!
@Fmbalbuena This might work as a challenge, where your score is how high you can go such that it works for all numbers below that (i.e. if you can do divisibility by 1,2,3,4 and 5, but not 6, your score is 5)
Not sure how much of it would just be lookup tables tho
@cairdcoinheringaahing ok
don't make golfed
22:14
@DomHastings Ah, interesting
It's a bit convoluted, but I was playing around with it ages ago trying to make a golfer Perl! Not much use if you need to predefine usable vars for every eventuality though I imagine...
22:50
It was below freezing today, and due to some misconfigured sprinklers at a city park, I saw ice for the first time this winter!
We've had 3 snow days this week, winter break basically got extended by a week here :)
Y'all are lucky, probably no snow for us this winter :/
Literally the entire UK got snow except for the city I was in a few weeks ago
No snow here today, just cold
(Okay, not very cold. I haven't been outside since morning, but it looks like it warmed up a fair amount this afternoon. Still below freezing, tho.)
23:22
@cairdcoinheringaahing you can thank my strategic vote capping for that
I've been going for the full 40 vote cap recently instead of the standard 30
@DLosc that's the period of time that I was active on esolangs.org and when I moved away from exclusively answering on Stack Overflow lol
23:50
@cairdcoinheringaahing not seen snow recently here
@pxeger maybe adding ?= such that x ?= [expression] is equivalent to x = ([expression]) ? x but i can't help but feel like any language designer would hesitate to switch the order like that
...that's another idea
backward versions of every augmented assignment operator
not sure if it would be worse to create an __ri[op]__ dunder for each of them or to refuse to
Ugh, I've been trying to route all assignments foo.bar = baz to my custom assignment function in Python, but there's no easy way to call it from C :(
Hacking the CPython interpreter is not as easy as pxeger made it out to be

« first day (3996 days earlier)      last day (1144 days later) »