« first day (2572 days earlier)      last day (2257 days later) » 

2:00 PM
As a class, we're at the point where some wonder what the value of 0^0 is...
 
But you could argue 0 because you can't hand prepare bags with more cookies than you have in total.
 
for friend in friends: if answer != friend.cookie_count: print "wrong answer"
see? 0/0 can be whatever you want
 
ngn
how do you define division?
 
@Fatalize but at least they'll know that there is reasoning behind it, rather that just a stupid thing the teacher came up with. Until I got proof for the pythagoras theorem I actually thought that it was a definition not a consequence, and that changed even before I understood the proof
 
@Fatalize It can't be that hard to explain going from both sides and how the limit is different - it would be even easier without fancy notation
 
2:01 PM
@ngn a/b == a*(b^-1)
 
ngn
@HyperNeutrino how do you define "to the power of neg one"?
 
uh then how do you define x^(-y) where y >= 0
ninja
 
@NieDzejkob NARS APL lets you decide what you want it to give. APL traditionally says 1, but Dyalog lets you choose 0 if you want. J says 0.
 
it depends on what you're doing :D
 
@HyperNeutrino You cannot use something you're trying to define. a*(b^(-1)) is defined as a / (b^1) = a/b ...
 
2:02 PM
@EriktheOutgolfer -4 bytes x^y where y < 0
 
it's usually defined as 1 / (x ^ y), which uses division itself
 
ngn
the usual answer is "the number that when multiplied by 'a' gives the identity element"
there's a hidden assumption in the word "the"
 
@ngn Which is all numbers.
 
@HyperNeutrino I emphasized the - there
 
ngn
that such a number exists and it's unique
 
2:03 PM
I'm pretty sure "division" is defined by multiplication
and not the other way around
@ngn typically, yes, whatever the identity element is for your purposes
 
Multiplication with reciprocal, yes. Not exponentiation. You're using exponentiation...
 
@HyperNeutrino so, then how do you determine x * 0.5 is the same as x / 2?
 
ngn
when a=b=0 the result is not unique, so "the" is nonsensical
 
@dzaima I made an animation of it on KhanAcademy almost half a decade ago (very badly programmed) -> khanacademy.org/computer-programming/pythagoras-theorem-proof/…
 
no when b=0 the result is non-existent because there is no element that gives 1 when multiplied by 0
 
2:05 PM
@ngn and therefore 0 has no defined reciprocal
 
@ngn Maybe it should be 𝕆
 
You all seriously overestimate the average capableness of people in math (and other topics for that matter). Sure here, you find 14 year olds who can program, who know about complex numbers and all. You find educated people, with way-above-average culture. But don't take you own experience and PPCG's experience as a representative sample of all people. School programs are aimed at a middle ground, so yes it might be easy for you but not for others. There's nothing wrong with it. Be more humble.
 
ngn
@EriktheOutgolfer right
 
@Fatalize anything is possible with enough time, effort, and the right learning methods :D
 
It's the first time I'm asked to be more humble lol
 
2:06 PM
@Fatalize I live it every day in Greece, the system is terrible
 
@Fatalize Also I would be a lot more forgiving of the system if it was separated by ability rather than age
 
@Fatalize that most are bad at math doesn't mean that the few good ones should be held back (and taught incorrect stuff)
 
ngn
@Solver or: by children's own interests
 
Greece's system doesn't depend on age for grades 7-12
 
2:08 PM
Same. We must get a very good grade to enter some of the best schools in the country, but then what we're taught is the same as what the others are.
 
but you still can't skip grades
 
@ngn Sure, a lot would chose the subjects staying awake, how to eat junk, where to find junk to watch.
 
for example if you don't pass grade 11 you redo it next year, and the cycle continues
 
@Fatalize I definitely agree with you, but another thing about school that I believe could be improved is that it targets the "average" student, making it poorly suited for almost all people because everyone thinks and works differently and few people are even close to being "average" on all aspects. And I also agree with Erik, splitting it by age would solve problems on both sides because that way people ahead of their age level can get the education they need as well as people behind that.
 
@EriktheOutgolfer Yeah but I am pretty sure you must be extremely dumb to manage to fail a grade lol. Same here
 
2:09 PM
@ngn I have a feeling that that could go very wrong
 
@Adám ...how to get away from parents, etc.
@Mr.Xcoder I think your perspective will change when you get to grade 10, yes middle school is easy
 
CMC (for languages with variables): Given a variable name, do nothing if it already exists, otherwise initialise it to an empty list.
 
@EriktheOutgolfer I don't think so.
 
but now that I'm in grade 10 everything is suddenly a lot harder, I presume thanks to the terrible system
 
@Adám What do you mean by "it already exists"
 
ngn
2:11 PM
@Fatalize that's an apl thing...
 
@Fatalize If a variable of that name already has been initialised.
 
Can it be a code snippet
 
@HyperNeutrino Yes.
 
cool
Proton, variable name a: if a exists not a=[]
 
@ngn what? I can do it in Python too, even with globals
 
2:11 PM
@Mr.Xcoder I've had at least 3 (maybe 4?) classmates that have failed a grade and been left behind :p
 
@ngn No, I'm sure other languages have the concept.
 
My favourite part of my school is the amount of homework - there is so much homework, but it taught me important lessons in task management, and I now waste much less time on random things
 
@ngn Speaking of which: How would you do that in APL?
 
@Adám Python, 32 (I think)
 
@Solver sadly homework hasn't taught me time management and I just do homework the morning before the due date (except projects & big stuff)
 
2:13 PM
@EriktheOutgolfer You should also presume that it is because of you. Some people find it a lot harder going from grade 6 to grade 7. Some people find grade 10 stupidly easy.
 
@Mr.Xcoder How can that work?
 
@Mr.Xcoder Nevermind, TypeError: argument of type 'builtin_function_or_method' is not iterable
 
ngn
@Mr.Xcoder globals() is a function, you need parens after it
 
@Adám It doesn't
@ngn It still is invalid anyway.
 
@Mr.Xcoder 1. globals is a function 2. that makes it into the variable name if it exists; invalid
 
2:14 PM
@HyperNeutrino I know...
 
@Fatalize of course that may also be a factor, but I've observed vast differences which will generally make life harder through high school compared to middle school
 
Python, 42 bytes: TIO
 
for example different laws which make life harder through high school
technically speaking, that's a full program and therefore can't work
 
@Adám PowerShell, 22 bytes -- if(gv a){}else{$a=@()} -- Try it online!
 
Also, I count 44 bytes
 
2:17 PM
If you need to take the variable name as input, then swap out gv a with gv "$args"
 
This conversation seems somewhat fruitless, when everyone lives in different countries. It just sounds like a lot of moaning
 
that's what i meant lol
 
@HyperNeutrino doesn't that only work for the input of i? :p
 
@H.PWiz The CMC is on-topic. Solve that!
 
Is there, on meta, any list of trivial challenges that might be good examples for showing out new languages?
If not, would it be a good idea to create this?
 
2:18 PM
@dzaima right... 47 bytes
@labela--gotoa Hello World, PLQ
 
@Adám Is it guaranteed to be a valid name?
 
@labela--gotoa They were called "catalogue challenges" but I think the consensus is that it's a bad idea
 
Python 2, 37 bytes: Try it online!
 
476
Q: Showcase of Languages

Calvin's Hobbies Notes This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions. This is no longer a popularity-contest, nor are sni...

@H.PWiz Sure.
 
@labela--gotoa To create a meta post for that, no.
There are a few gists though
 
@labela--gotoa Trivial, or canonical? Canonical would be "Hello, World!", and "FizzBuzz" and the like.
 
0
A: Sandbox for Proposed Challenges

Magic Octopus UrnLongest Palindrome from Palindromic Substrings Given a string l, find all palindromic substrings p of l (including duplicates). Then, rearrange all sub-strings in p into a valid palindrome (there may be multiple correct answers). Examples l = anaa p = ['a', 'n', 'a', 'a', 'aa', 'ana'] result...

 
@AdmBorkBork I don't really know the diff, maybe you're right
thanks for help
:P
 
Well, "trivial" would be like the "add two numbers" challenge.
That's not really a good showcase of a new language.
"Canonical" here would mean "tasks that are common for starting out programming" and would be a good showcase for a new language.
 
2:21 PM
CMP: Should accessing an uninitialized variable in Proton 2 give an error or None?
 
@labela--gotoa Shouldn't have helped you with such a vile nickname!
 
@HyperNeutrino Default the variable to $null
 
@Adám {×⎕NC ⍵:1⋄⍎⍵,'←⍬'} Although its not very golfy
 
what's that
 
It comes in really handy in golfing.
 
2:22 PM
@HyperNeutrino Remind me, is Proton practical or recreational/golfy?
 
meant for practical
 
@HyperNeutrino Then error.
 
Proton 1 just gives None and Proton 2 errors (currently)
okay
 
Oh, yeah, if it's practical, it should error.
 
@H.PWiz Exactly what i had too.
 
2:24 PM
@HyperNeutrino IMO it should be as an option, but that would be too confusing to work well. But yeah, erroring is better I'd say
 
Why'd you have variables in a recreational language lol?
 
more command line flags ¯\_(ツ)_/¯
--no-error-on-undef
 
That's too golfy :P
 
@Mr.Xcoder for golfing langs that sentence would apply, but not for recreational languages
 
@Mr.Xcoder ಠ_ಠ
 
2:26 PM
@Fatalize ಠ_ಠ
Actually 05ab1e also has variables
 
@HyperNeutrino the problem with a global flag is that some parts/libraries/stackoverflow code would expect it to be one way and other parts the other
 
@Mr.Xcoder I read that as "Actually and 05AB1E"…
 
@Mr.Xcoder You need a comma after "Actually" (both grammatically, and to get proper ambiguity).
 
:( :( :(... :)
@Adám Can't edit. I thought grammar wasn't a thing in chat :p
 
2:29 PM
@Mr.Xcoder you are the identity function?
 
Kinda
 
@Mr.Xcoder Adám's asking for ambiguity :p
 
@Fatalize Is there a single byte command for getting the last element of a collection (list) in Brachylog?
 
@Mr.Xcoder t — tail
 
Thanks...
I'm blind
 
2:31 PM
(that works on numbers and strings too obviously)
 
ಠ_ಠ I didn't see it because I had accidentally inserted a comma before "last" while CMD+F ing.
For once, Pyth beats 05ab1e \o/
 
It's happened before ;)
 
ngn
I'm trying to design a challenge. It requires ~1MB of data as input. Is there a recommended place to upload it?
 
github?
 
ngn
@Fatalize that's what I thought too, but I was hoping for something more permanent and closely associated with the SE network
 
2:40 PM
It doesn't appear that CrazyPython is online... his bounty is about to be automatically awarded (to the wrong answer). codegolf.stackexchange.com/q/99674/34718
 
@ngn no, SE doesn't have anything of that sort
 
ngn
@EriktheOutgolfer thanks
 
@ngn Host a file on Google drive?
 
@ngn well, you could make 16 posts in the sandbox :p (or save parts in the revision history :P)
 
ngn
2:42 PM
@dzaima or hide it in the lower bits of my avatar :)
 
@ngn yeah, an idea in my mind was to have it as the bits of an image :p
 
@ngn but you don't have an avatar do you? or you mean the identicon?
 
ngn
@EriktheOutgolfer ah, I didn't know that word :)
 
@mbomb007 Nvm. There is a 24 hr grace period for bounties to be awarded.
 
ngn
@EriktheOutgolfer I don't have an avatar, no. I meant I could upload one. But that was a joke.
 
2:45 PM
That assumes the bytes of the image would stay the same after making it your avatar
 
ngn
the challenge in question is tetris strategy
initially I designed it to get randomness from a Starry Night png mod 7, but that may be too distracting from the main purpose
which is to play tetris well as if the pieces are completely random
 
3:12 PM
@Downgoat 10/10 I definitely agree!
 
CMQ: What would you want to see in a Dyalog webinar?
 
3:28 PM
0
Q: Longest Palindrome from Palindromic Substrings

Magic Octopus UrnGiven a string l, find all palindromic substrings p of l (including duplicates and single character strings). Next, rearrange all sub-strings in p into a valid palindrome (there may be multiple correct answers). If it is not possible to rearrange p into a single palindrome, your program may have ...

 
2 challenges in 2 minutes
 
challenge-posting-ninja'd
 
@Adám All the things you can say about 17.0
 
@Mr.Xcoder a substring is just the original string with an arbitrary number of characters deleted, right?
 
@Pavel Too much for a single Webinar, but yes, we are doing some of that. The next one will be on TAO.
 
3:34 PM
@flawr No, a substring is a contiguous subsequence of another string.
 
ngn
@Adám sex and violence! :)
 
you mean sax and violins?
 
@flawr No, SAX — Sharp Apl for uniX.
 
ngn
@flawr whateva its spelld laike
 
3:47 PM
4
Q: Bertrand's Primes

flawrBertrand's Postulate states that for every integer n ≥ 1 there is at least one prime p such that n < p ≤ 2n. In order to verify this theorm for n < 4000 we do not have to check 4000 cases: The Landau trick says it is sufficient to check that 2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503...

 
suddenly lots of new challenges
 
4:27 PM
@flawr 10k on Math.SE! Congrats!
 
:O I didn't realise Luis was an active SO member... TIL he has nearly 87k rep there
 
I am mildly surprised that I have 1k math.se rep, forgot ever being moderately active there.
 
> Matlab's ' is not transpose; .' is. sum(x) is not sum over each column. sum(x,1) is.
Lol
 
^ You'd be surprised at how many people make mistakes (often difficult to debug) because of that
 
Now I wouldn't be surprised, having heard that from a Matlab master :)
 
4:36 PM
blushes
 
@Mr.Xcoder So is sum(x) over the rows?
 
0
A: Sandbox for Proposed Challenges

ScroobleLock My Bike I bike places, and I would like to stay able to do so. Therefore, I lock my bike whenever I leave it in public. The lock I use is a cable with a 4-digit permutation lock: When I lock my bike, I like to leave the lock at 0-0-0-0. Recently, I have run into trouble with my lock. It...

 
@Adám I think it is summation over columns for 2D arrays, but it doesn't work for higher dimensions? IDK Matlab (cc @LuisMendo?)
 
@Mr.Xcoder It sums over the first nonzero dimension
 
> S = sum(A) returns the sum of the elements of A along the first array dimension whose size does not equal 1.
If A is a vector, then sum(A) returns the sum of the elements.
If A is a matrix, then sum(A) returns a row vector containing the sum of each column.
If A is a multidimensional array, then sum(A) operates along the first array dimension whose size does not equal 1, treating the elements as vectors. This dimension becomes 1 while the sizes of all other dimensions remain the same.
So I think I was pretty close
 
4:39 PM
@Adám sum(x) sums along the first non-singleton dimension. So it usually gives the sum of each col, unless the array is for example a row vector
>> sum([1 2 3; 4 5 6])
ans =
     5     7     9
>> sum([1 2 3])
ans =
     6
 
@Giuseppe Ugh. APL is so simple. ⍉x transpose x. Sum rows: +/x. Sum columns: +⌿x. Sum nth dimension: +/[n]x. No exceptions.
 
The "exceptions" in Matlab are handy when you are dealing with vectors and don't care about their orientation. But yes, they can sometimes be a mess. So it's better to indicate dimension explicitly:
>> sum([1 2 3; 4 5 6], 1)
ans =
     5     7     9
>> sum([1 2 3], 1)
ans =
     1     2     3
 
@LuisMendo For vectors, +/ and +⌿ do the same, as they are defined as over-last-axis and over-first-axis, so since vectors only have one axis, they are equivalent.
 
@Adám for another comparison, R's version of sum sums all entries of an array or vector so to sum a single dimension you have to do apply(array,[dim],sum) although there are aliases (which are faster) for summing rows and columns, cleverly named rowSums and colSums
 
@Giuseppe In APL, to sum all elements: +/,x (because , is ravel≈flatten)
 
4:44 PM
^^ sum in Numpy does the same, I think? Sum everything if no dim specified
 
IIRC yes
 
@Adám So is there such thing as a 1x3 matrix? Does that have one or two axes?
 
@LuisMendo Two.
 
In PowerShell, you get to roll your own, because no form of matrix operations are built-in. (Unless you count the .NET framework calls for working with Direct3D, but that's a separate animal entirely)
 
to be fair R has a lot of implicit behavior that it doesn't always warn you about, though, so the consistency of sum is an island in the ocean of recycling/implicit conversions
 
4:46 PM
Python equivalent of using namespace (numpy.sum in conflict with sum)
 
@LuisMendo APL (of course) has full-fledged array support. You can have many or few dimensions, and each dimension can have any non-negative length. This is unlike JSON and other list-based approaches where you cant have a 0-row, 2-column "matrix".
 
And why you would want to code Direct3D in PowerShell ... /shudder
 
@Adám I see
 
@LeakyNun another recipe idea for you
 
@Giuseppe Yeah, I've been watching a few Wat videos about various languages lately. Now I don't feel so bad about APL's quirks. Yes, there are quirks, but they are not where as numerous or as serious as other languages'.
 
4:48 PM
smoked salmon wraps with cream cheese and lettuce
 
Thanks for making all of us hungry :-P
 
Btw great way to avoid oneboxing.
 
@orlp I make this all the time
it's a good quickie
 
and delicious
 
@Mr.Xcoder That looks pretty good. I thought Leaky Nun said he couldn't cook — which is why (and to learn APL…) he dropped in by me for dinner.
 
4:52 PM
@Adám say, can dyalog use CUDA (or otherwise leverage the GPU for matrix stuff)?
 
@Adám you live in the UK?
 
@quartata I know it can, no clue how though.
 
that's nice, wonder why I've never seen any machine learning libraries for APL
seems like a good fit tbh
 
@quartata Not directly, but the co-dfns compiler will compile for GPUs.
@orlp Yes, in London.
 
if i put a puts() before a malloc() call it works but if i dont it causes an assertion to fail hastebin.com/qeweqenibo.erl
wtf
 
4:56 PM
@quartata Have you tried searching for "apl neural networks"?
 
@Adám yeah but that's all fairly barebones
 
@betseg source code?
 
@betseg undefined behavior \o/
 
albeit delightfully succinct
as usual
 
@NieDzejkob only the part that matters (i think): hastebin.com/anuwokerok.c
 
4:59 PM
@betseg for(i=0; i<=height; i++) {
really?
 
oh
 

« first day (2572 days earlier)      last day (2257 days later) »