« first day (1426 days earlier)      last day (1229 days later) » 

3:00 PM
⋄ { dupa ← (⍵÷⍳⍵) ⋄ wielkadupa ← +/dupa = ⌊dupa ⋄ wielkadupa÷wielkadupa } 7
 
@Konrad'Unrooted'Klawikowski 1
 
⋄ { dupa ← (⍵÷⍳⍵) ⋄ wielkadupa ← +/dupa = ⌊dupa ⋄ wielkadupa÷wielkadupa } 10
 
@KamilaSzewczyk 1
 
brah
this always returns 1
because a÷a=1 by definition, even for the edge case of a=0
 
3:03 PM
Ouch, right!
 
@Konrad'Unrooted'Klawikowski What was the definition of a prime, again?
 
3:14 PM
Divisible by 1 and itself
 
So that makes how many divisors in total?
 
tio.run/##SyzI0U2pSszMTfz//… close to shaving a char off but not quite
 
@Adám just 2 of them
 
@Konrad'Unrooted'Klawikowski OK, so how would you check if wielkadupa is 2?
 
3:19 PM
Yes, so can you put it all together?
 
⋄ { dupa ← (⍵÷⍳⍵) ⋄ wielkadupa ← +/dupa = ⌊dupa ⋄ wielkadupa=2} 7
 
@Konrad'Unrooted'Klawikowski 1
 
⋄ { dupa ← (⍵÷⍳⍵) ⋄ wielkadupa ← +/dupa = ⌊dupa ⋄ wielkadupa=2} 10
 
@Konrad'Unrooted'Klawikowski 0
 
Very nice.
I'm not saying you should do this, but you can: ⋄ {2=+/ ass= ⌊ ass ← ⍵÷⍳⍵ } 10
 
3:22 PM
@Adám 0
 
Maybe APL is unreadable after all
 
@rak1507 wdym?
 
The names
 
Just plain Polish for ass and bigass.
 
this
@Adám aaaaa, makes sense now
 
3:24 PM
well TIL
 
@Konrad'Unrooted'Klawikowski Can you think of a way to get rid of the last variable? Hint: Functions can contain functions.
 
so can I make {dupa{wielkadupa}}?
 
Yes.
 
I have no other ideas for names but I hope it's still fine with you
it's a Polish tradition, dupa driven development
 
lol
there are 26 letters in the alphabet why not start with those ;)
 
3:27 PM
frakcje might be an appropriate name for this. Don't know Polish, though.
 
fractions?
gonna go with it then
@Adám you mean both your and mine code or just mine or just yours
 
Mine.
 
so the way to replace ⍳⍵?
 
No, a way to replace var←
 
3:30 PM
does he know about | yet? might be useful/simplify things slightly
 
No he doesn't, but I'd like to teach inner helper-functions.
 
Ok cool
 
⋄ {2=+/ (⍵÷⍵) = ⌊(⍵÷⍳⍵) } 10
 
@Konrad'Unrooted'Klawikowski 0
 
⋄ {2=+/ (⍵÷⍵) = ⌊(⍵÷⍳⍵) } 7
 
3:31 PM
@Konrad'Unrooted'Klawikowski 0
 
You're missing the but I don't want code duplication, so this is not what I had in mind.
 
⋄ {{2=+/ (⍵÷⍵)} = {⌊(⍵÷⍳⍵)} } 7
 
@Konrad'Unrooted'Klawikowski SYNTAX ERROR
 
haha, I broke something again
 
3:32 PM
Do you remember the definition of IsInt?
 
What was it?
 
omega = floor omega
 
Well, critically, there had to be braces around that.
 
3:34 PM
Now, any such function can be used inside another function. So, assuming you had already defined IsInt, how might you write IsPrime in terms of IsInt?
 
@Adám ułamki?
 
{⍵ = ⌊⍵} this was IsInt, and IsPrime was { a ← (⍵÷⍳⍵) ⋄ b ← +/a = ⌊a ⋄ b=2}, so I'd try +/ a= ⌊⍵ or something, idk
@KamilaSzewczyk yeah, he meant that I think
 
I made a horrible abomination partially resembling Dyalog APL Extended
 
I added stuff like string formatting: 'a⍝bc⍝d'$1 2 => a1bc2d
the implementation is quite disappointing but it works: {∊('⍝'(≠⊆⊢)⍺),¨⍕¨⍵,⊂⍬}
 
3:42 PM
@Konrad'Unrooted'Klawikowski Hold on, try integrating IsInt into {2 = +/ u = ⌊ u ← ⍵÷⍳⍵ }
@KamilaSzewczyk Do you know that ⎕FMT can do that and more?
 
@KamilaSzewczyk Also, did you see this?
 
hm. but at least my format is tiny which makes it suitable in some golfs
 
Why not just use dyalog extended
 
I want to make something on my own
 
3:47 PM
Fair enough, but for golfing
 
I had many approaches at golfing languages, but this is the only one which is actually close to being somewhat usable
later on I'm going to work on primtives and trying to expand the domain of them
 
Oh, are you trying to write your own golfing language? cool
 
I actually attempted at it multiple times
 
sorry Adam I really do have no idea for that
 
I know languages like esmin or japt or osable but they all seem ridicously braindead
meanwhile APL looks legitimately interesting to golf in
 
3:50 PM
even if I use my version
 
@KamilaSzewczyk You could use the Extended framework, and just (re)define the glyphs you wanted.
 
@KamilaSzewczyk I agree APL is really fun to golf in, I don't really get the appeal of doing something like osabie where it's more a 'pick the right builtins for the job'
 
@Adám as I mentioned, I want to make something on my own
 
⋄ {2 = +/ ⍵ = ⌊ {⍵ = ⌊⍵}} 7
 
@Konrad'Unrooted'Klawikowski SYNTAX ERROR
 
I'd write a full APL interpreter but the only thing that was putting me off is the amount of work required to have optimizations ready
 
@KamilaSzewczyk Ah, I wasn't sure if you wanted to make your own extensions or if you wanted to make your own implementation. Now I understand.
 
i'd need a codepage, I'd need to somehow adjust flex/reflex and bison to work with silly APL glyphs
 
When are you doing APL in malbolge
 
i could theoretically do J in malbolge
APL seems to annoying due to charset
 
3:53 PM
malbolge in APL in malbolge
 
@KamilaSzewczyk Modelling APL in APL has a long history. Iverson praised the ability to do so.
 
lisp macro flashbacks
so sad we don't have a way to properly return functions or other "callables"
 
return the string and execute it
 
that's going to be peak slow, but it's fun, maybe :p
 
oh yeah it's a terrible idea in practice, just quite fun
 
3:55 PM
it's so easy to make something peak slow in APL, just use the stencil operator in a convoluted way so the interpreter doesn't recognize the special combination
 
@KamilaSzewczyk Well, tradfns can actually return a function… Alternatively, you can pass an object with a function, or a ⎕OR
 
⋄ {2 = +/ ⍵ = ⌊ {⍵ = ⍳⍵}} 7
 
@Konrad'Unrooted'Klawikowski Think about what the {⍵ = ⍳⍵} function sees as its argument there.
 
⋄ {2 = +/ ⍵ = ⌊ {⍵ = ⍳⍵}⍵} 7
this killed the bot
 
@KamilaSzewczyk or use the stencil operator normally....
 
3:57 PM
@rak1507 Except for with the few special-cased operands.
 
ngn
@KamilaSzewczyk better do k in asm
 
x←⌺ makes Iverson spin around in his grave
 
⋄ adder←{'{⍵+',(⍕⍵),'}'} ⋄ add6←⍎adder 6 ⋄ add6 10
 
@rak1507 16
 
who needs haskell!
 
3:57 PM
@rak1507 everyone
 
lol
now do pattern matching in APL
 
but... wait
it's possible
using dfn guards
 
yeah
 
then no one needs Haskell
 
3:58 PM
i actually really got hooked on APL
it's shocking that I used to prefer writing in C or x86asm and did such a huge abstraction level jump
@ngn i wonder what's the original implementation programmed in, I once ran it on my crappy old processor but it crashed because I don't have AVX-512
 
haha MT in APL... sounds fun
 
ngn
@KamilaSzewczyk c + a few lines of asm
 
makes sense
 
I wondered if you can parallelise MT to work on multiple seeds on once in APL but it seems far too iterative to be doable in some sort of array oriented way
 
@rak1507 This:
      adder←{o←⎕NS ⍬ ⋄ o.f←+∘⍵ ⋄ o} ⋄ apply←{⍺.f ⍵} ⋄ add6←adder 6 ⋄ add6 apply 10
16
 
4:00 PM
I've checked whitney's B language, but it seems like a horribly bad scam
 
ngn
@KamilaSzewczyk luxury, i don't even have avx on my current netbook :)
 
it crashes on my PC and the claim that it matches gcc/clang performance seems pulled out of arse
 
@Adám wow that is painful
 
How about this:
      adder←{f←+∘⍵ ⋄ ⎕OR'f'} ⋄ apply←{⍺⍺ ⍵} ⋄ add6←adder 6 ⋄ add6 apply 10
16
 
ngn
@KamilaSzewczyk did you read the commented (by someone else) version?
 
4:01 PM
@rak1507 i considered parallelizing the MT cracker but I didn't get around to doing that anyways, probably it wouldn't help
@ngn I did, but it doesn't compile
 
ngn
@KamilaSzewczyk right, i wasn't able to compile it either. beautiful source, though.
 
oh yeah, that's undeniable
 
so beautiful it doesn't work
 
but yeah, working > beautiful and not working
 
@Konrad'Unrooted'Klawikowski Let's put the two definitions together:
{ ⍵ = ⌊ ⍵ }
{ 2 = +/ u = ⌊ u ← ⍵÷⍳⍵ }
Do you see a pattern?
 
ngn
4:03 PM
@rak1507 i'm sure it worked on some combination of a compiler version, arch, and flags..
 
i'm sure that it's x86_64
 
compiler version, arch, flags, phase of the moon, weather conditions, incantations muttered at that exact moment...
 
the flags are provided with the makefile
so you'd probably need to seek just for the compiler version
@rak1507 well, by the looks of things the interpreter/compiler/whatever seems to produce huge quantities of nasal demons
 
@Adám in the second one the right side of ⌊ can be replaced with IsInt?
 
@Konrad'Unrooted'Klawikowski No, that's not right. How about now:
 
ngn
4:05 PM
@KamilaSzewczyk beautiful > ugly+working because you can learn good style from it
 
       { ⍵ = ⌊ ⍵ }
{ 2 = +/ u = ⌊ u ← ⍵÷⍳⍵ }
 
Arthur's style is beautiful, but I don't necessarily want to learn it.
 
ugly and working always wins over beautiful for anything practical
 
^ this is the reason why PHP is still in use
 
ngn
@rak1507 that's from a user's PoV
 
4:07 PM
7 billion users, a handful of programmers, I know which market I'd try and cater to
 
@Adám sorry I don't really get it, I really don't have a good idea for that
maybe
 
Do you not see a repeating pattern between the two functions?
 
ngn
@rak1507 most of the $ is concentrated in a small %
 
I mean all I would see in here is that once you compare just omega with floor omega and the while later you compare 2 = +/ thing with floor u which is being replaced by omega÷omega
or am I too exhausted after physics and do I see angle speed in here
*angular velocity
 
You want to stop for now?
 
4:11 PM
@ngn I doubt that % really cares about the beauty of the C code
 
I mean, I just don't have an idea for that but I don't want to cheat nor look in the cheat sheet
 
@Konrad'Unrooted'Klawikowski omegas everywhere.
 
@Adám when do you usually award bounties from the APL bounty
 
@Konrad'Unrooted'Klawikowski OK, lets make a thought experiment. It isn't so, but let's imagine that $was a primitive monadic function that checked if the argument is integer. How might you use that in { 2 = +/ u = ⌊ u ← ⍵÷⍳⍵ } to simplify the code?
@KamilaSzewczyk Towards the end of the bounty week.
 
4:14 PM
makes sense
 
I guess I can do so now.
@KamilaSzewczyk Is there a reason you have not explained your last two?
 
i may add an explanation soon-ish
 
I'll give you a week or so to do that.
 
alright, when I'll be done I'll ping you
 
the limitation to one argument limits me too much, sorry Adam
 
4:17 PM
now I'm trying to decipher your hacky tio snippet
 
can you explain, please? it will be clearer
 
@Konrad'Unrooted'Klawikowski Do you fully understand how { 2 = +/ u = ⌊ u ← ⍵÷⍳⍵ } works?
@Razetime Can I bother you to clean up your bounty claims to use the short URL form?
 
Is that omega divided by floor omega assigned to u And u is an argument for that L?
 
@Konrad'Unrooted'Klawikowski Yes, and then again used as left argument for =
 
That L is floor sorry
 
4:23 PM
But what does the phrase u = ⌊ u compute?
 
Checks if it's Int?
 
Yes. So if $ was a primitive that checks if something is Integer, how would you rewrite the function?
 
{ 2 = +/ u $u ← ⍵÷⍳⍵ } if $ is = floor
Am I right?
 
Almost. Can you tell my why we found it necessary to assign the result of ⍵÷⍳⍵ to a variable?
Also, don't worry about how $ is defined. Just take it as a monadic function that determines intergerness.
 
@Adám to use it already as an argument?
 
4:29 PM
Did you mean "again" rather than "already"?
 
right, again
is it"
*?
 
OK, but now that we have a monadic function to check integerness, we only need the value once, right?
 
So how would the function look?
 
do I make a function in function already?
 
4:35 PM
Just use $ for now, even if it cannot actually run.
 
i missed the centenary, is the video up anywhere?
 
Not yet
 
@rak1507 ty
 
why not that one before?
I'm kinda confused there
 
@Konrad'Unrooted'Klawikowski Because it uses $ dyadically.
 
4:39 PM
so I have to change the order?
 
ngn
@rak1507 reading beautiful code helps build implementer skills. the customers in question care about speed, and that takes skill.
 
@Konrad'Unrooted'Klawikowski No, you just have to get rid of the left argument.
 
{$u ← ⍵÷⍳⍵ = 2 = +/ u }?
lmao
 
No no, why did you move everything around?
Take { 2 = +/ u $u ← ⍵÷⍳⍵ } and make sure $ is used monadically.
@Konrad'Unrooted'Klawikowski Do you remember what "monadic" and "dyadic" mean?
 
@ngn on modern hardware more people care about ease of use than speed unless what you're doing absolutely needs speed but that's probably a very rare scenario
 
4:43 PM
{ 2 = +/ ⍵÷⍳⍵ $(⍵÷⍳⍵)}?
@Adám monadic takes argument from right, dyadic takes two arguments from each side?
 
Right.
@Konrad'Unrooted'Klawikowski What does $ see as its left argument there?
 
{ {2 = +/ ⍵÷⍳⍵} $(⍵÷⍳⍵)} better?
@Adám just ⍵÷⍳⍵?
 
@Konrad'Unrooted'Klawikowski No, think about order of execution.
@Konrad'Unrooted'Klawikowski No, why the new inner braces there?
 
read from right to left but executes from left to right? aaaaaaa my head is burning lmao
too much flipping sides
 
@Adám what do you think about this: codegolf.stackexchange.com/a/216660/61379
 
4:46 PM
@Konrad'Unrooted'Klawikowski Let me know if you want to stop.
@KamilaSzewczyk You mean the explanation? Perfect.
 
{ (2 = +/ ⍵÷⍳⍵) $(⍵÷⍳⍵)} ?
ouch
 
OK, let's backtrack a bit.
You had { 2 = +/ u $ u ← ⍵÷⍳⍵ }
 
it messed a bit
in my head I mean
 
Your only task for now is to modify this minimally to make sure $ doesn't get any left argument.
What is $'s current left argument?
 
4:49 PM
just u?
or the whole thing?
 
This about the order of execution. How far left does a function see?
 
ngn
@rak1507 performance doesn't have to be at the cost of ease of use. i find the opposite is true - simpler code/interpreters/editors/tools.. are faster.
 
@Konrad'Unrooted'Klawikowski Correct. Now can you exterminate the left argument of $?
 
4:51 PM
True, that'd allow you to use u on both sides. But is $ monadic or dyadic?
 
So why are you trying to give it a left argument?
 
so the same but without tilda umlaut?
 
Yes. Type it out!
 
4:53 PM
No, type out the function as it would now look with a monadic call to $
 
@Adám I'll do it now
 
No rush.
 
{$ u ← ⍵÷⍳⍵ }?
 
Hold on, what happened to the rest of the function?
Task: Modify { 2 = +/ u $ u ← ⍵÷⍳⍵ } so $ is called monadically.
 
{$ 2 = +/ u ← ⍵÷⍳⍵ }?
 
4:55 PM
Why did you move $? Wasn't it supposed to take u as its argument?
Let's assume $ is a monadic function which can take u as its only argument and returns a result appropriate as argument for +/
 
@ngn in practice performance has always been sacrificed for usability, python being the perfect example
 
{$ u = 2 = +/ u ← ⍵÷⍳⍵ }?
to that thing before
 
@Konrad'Unrooted'Klawikowski Think of the flow of data from the right. ⍵×⍳⍵ returns a result which we call u and can be be fed to $ which returns a result which is fed to +/ etc.
 
ngn
@rak1507 it doesn't have to be that way, apl/j/k being examples
 
I'm totally lost while being limited to just one argument
 
4:59 PM
@rak1507 an "always" claim needs a bit more proof than a single example
 
always*

* - most of the time
@ngn all of which are harder to do a number of things in than most other languages
 
@Konrad'Unrooted'Klawikowski Hold on, never mind an implementation. If you are (in your head) to determine if a number is an integer, how many numbers do you need from me?
 
just the number and it's floor
 
No, you can figure out the floor by yourself.
 
that's right
so just a number?
 
5:02 PM
Correct.
 
@Adám should be fully shortened now
 
Thanks
@Konrad'Unrooted'Klawikowski And if $ was a function that that determined integerness, how many arguments would it need?
 
{$ n}
it would be like that?
 
Yes.
And if the argument was called u instead of n?
 
5:03 PM
Right.
Now lets go back to { 2 = +/ u $ u ← ⍵÷⍳⍵ }
Do you see the problem here with how $ is used?
Actually, let me rephrase the function.
 
it does have things on left?
 
Right.
{ u ← ⍵÷⍳⍵ ⋄ 2 = +/ u $ u }
Using ↑ this function, how can you fix it so $ is used correctly?
 
you've splitted it with ⋄ hmmm
can I do the same?
 
You don't need to. Compare to u - u ― what if you didn't want to subtract u from itself, but rather wanted to negate u?
 
then not u-u but just -u?
 
5:07 PM
Exactly.
And what if you didn't want to use $ dyadically between u and u, but just wanted to apply it monadically to u?
 
{ u ← ⍵÷⍳⍵ ⋄ 2 = +/ $u }?
 
Exactly! Well done.
 
Now, look at this function. After defining u, how many times do we use it?
 
https://codegolf.stackexchange.com/a/216657/61379
https://codegolf.stackexchange.com/a/216647/61379
@Adám how about these two?
 
5:10 PM
Can use dyalog extended to use ⊤ instead of 2⊥⍣¯1 btw
 
@rak1507 Yes.
@KamilaSzewczyk Isn't there a 100/101 mismatch there?
 
oops, fixed
 
@KamilaSzewczyk (',_',⊢)¨',_'∘,¨
 
@Konrad'Unrooted'Klawikowski Correct. Do you remember why we saw the need for a variable in the first place?
 
5:13 PM
not to do the same thing twice
 
But now we only need it once! Can you somehow eliminate the assignment?
 
updated
 
can (+/∘~<+/) become (≢<2×+/)
 
amount of unset bits < amount of set bits vs tally < doubled amount of set bits
hmm
 
@KamilaSzewczyk Do you know about the 'a',(expr),'b'1⌽'ba',expr golfing trick?
 
5:16 PM
in my head it makes sense
 
i think it makes sense
@Adám now I do
yeah it's correct
 
@KamilaSzewczyk Well, it saves you 1 byte here. You see it?
 
sec, I'll update the other answer
 
Other than those golfs, it looks good.
 
⎕IO←0 and ⍳101 instead of 0,⍳100?
Ah, ⍳ is being used elsewhere
 
5:19 PM
^
 
Could use Extended's instead of 0,⍳
 
{2 = +/ $(⍵÷⍳⍵) }?
wait it's not monadic
 
that works
 
@Konrad'Unrooted'Klawikowski Sure it is, and that's right. But why the parenthesis? This isn't jQuery.
 
lol
 
5:21 PM
lmao
I like those parens
they kinda help me
 
@Konrad'Unrooted'Klawikowski as long as you use ⍵ and don't use ⍺, it is monadic
 
OK. No worries.
 
so now I have to replace $ with =⌊?
 
No. Replace it with your IsInt function.
@KamilaSzewczyk Any success?
 
i looked at it just a second ago
 
5:24 PM
so I replace $ with {⍵=⌊⍵}?
 
Yes! Try to write it all out.
 
18⌽' {public Object _0class Tuple','5' outputs the correct result
ah no, wait, it golfs
 
{2 = +/ {⍵=⌊⍵}(⍵÷⍳⍵)?
 
}
 
right, missed one!
 
5:29 PM
@Konrad'Unrooted'Klawikowski Yup, and there you have it. OK that's enough for now, I think. Time to prepare dinner for the family.
Got rest your brain. You've been exerting it.
 
Do you do any tacit programming in Haskell?
 
@Adám in the end this trick saves no bytes because you need to parenthesize that expression or use commutes which pile up to outweigh the parens
 
@Adám Gute Apetit
thanks for everything
@rak1507 me?
 
yep
 
I've watched one slideshow about it and heard about it during Haskell Love, someone mentioned it
 
5:33 PM
@KamilaSzewczyk This:
↑{∊'class Tuple'(⍕⍵)' {public Object _0'((',_',⊢)¨⍕¨⍳⍵)';}'}¨1-⍨⍳100
↑{2⌽∊';}class Tuple'(⍕⍵)' {public Object _0',(',_',⊢)¨⍕¨⍳⍵}¨1-⍨⍳100
 
or maybe I get a wrong idea and seen it more often
 
@Konrad'Unrooted'Klawikowski ok cool was just curious
 
ohh
I applied it to ⍕⍵ instead of that other thing, that's why it didn't help me
 
problems.tryapl.org @Konrad'Unrooted'Klawikowski if you ever want some fairly simple problems to try have a look at these, there are sample solutions available as well if you get really stuck (or people can help here)
 
thanks Buddy
also keep that in mind that I'm not a Haskell master
 
5:35 PM
y'no Dyalog APL 18
 
when it comes to Haskell thing
 
alright
 
I wish to know as much things as @KamilaSzewczyk does
 
I think that's impossible
 
she's the best in everything
@rak1507 ah, right
 
ngn
5:38 PM
@rak1507 no aoc today?
 
been feeling a bit under the weather for the past few days so haven't looked at anything past 19 yet
 
ngn
@rak1507 get well soon
 
thanks :)
 
@KamilaSzewczyk Working on it. It is currently using TIO, so we have to use a different backend.
 
5:51 PM
@ngn did you do yesterday's AoC?
I started it in Python as I thought it'd be too hard for my APL. That was a mistake.
 
ngn
@xpqz only in k
@xpqz i translated part1 to apl but gave up on part2
 

« first day (1426 days earlier)      last day (1229 days later) »