« first day (1374 days earlier)      last day (1263 days later) » 

3:49 AM
{({⊃(,,⍤0)/↓(⌽@1)2(2÷⍨≢⍵)⍴⍵}⍣{⍺≡w})w←2(⊥⍣¯1)⍵}201
How do I find out how many times loops?
 
4:00 AM
@Razetime A classic way is to use a local variable and increment each time the loop runs.
 
hmm ok
 
But I think dfns.traj could work in your case, as you're running until you encounter the original input again
 
oh so it needs to be local local
not in the function
@Bubbler I think limit works better
oh nevermind that's just ⍣≡
 
No, this setup should work: {i←0 ⋄ i⊣{i+←1 ⋄ one_iteration}⍣{end_condition} start_value} if you want to return the iteration count
 
cool
lemme see if traj is any shorter
doesnt seem to work here: Try it online!
(Extended)
 
4:15 AM
@Razetime You used wrong input section there
 
ah yes my genius shines through
 
But yeah, Extended is known for being quirky with assignments
 
So it does run 4 times
just that i displayed at the end is 0
 
But it does work in non-Extended
though other parts are a bit verbose
 
Try it online! traj is very golfy
Try it online! 32 with a full program
 
4:23 AM
Yes, it's pretty useful in various occasions
Also 29
 
oh, monadic ⊤
cool, we beat CJam
 
CJam is ASCII-only, so it's at least occasionally beatable with APL
 
Then there's Pyth😁
 
Pyth is almost unbeatable, so it's one of my hated golflangs
 
ah well
its really good for complex challenges
 
4:45 AM
am I doing something wrong here? Try it online!
 
@Razetime 2|≢⍵ is a scalar, and if you try 2 ¯1⍴ on it, can't determine the length of the second dimension
 
oh yeah
Need to use :
 
Good.
 
now it should work for any \$n\$
yay no mathjax
 
You can't mathjax in chat
 
4:52 AM
that's a funny tag
 
I like the more
 
 
3 hours later…
RGS
8:02 AM
@Razetime What does traj do?
APLcart says "function limit trajectory" but what does that mean?
 
@RGS You know you can click the (?) icon?
 
RGS
@Adám Erm, I completely forgot there was a docs link.
 
@RGS It iterates the left operand function, collecting intermediate results, until it encounters an already seen value.
 
RGS
Yes, traj is short for trajectory. Understood.
 
8:19 AM
traj stands for TRApped in Jail
 
RGS
@Razetime If you say so :p
 
wow now I'm teaching
 
 
2 hours later…
10:12 AM
@rak1507 I'm currently working on ⌽. Turns out there are several bugs in its implementation.
 
 
2 hours later…
11:58 AM
@EliasMårtenson cool
 
 
3 hours later…
RGS
3:10 PM
M⍋s⊤∊r⍳ng Dy⍋⌊○g ⍋P⌊
^ New suggested title for the "Mastering Dyalog APL" book.
 
Beautiful
 
˜⍺⌈~∊⍴⍳⊤∇ Î↑⍺⎕○∇ Å⍣⌷
a literal translation
 
RGS
I get this: ∥⍺⌈~∊⍴⍳⊤∇ ∙↑⍺⎕○∇ ´⍣⌷
With Adám's keyboard.
 
hmm I'm using the mac layout
 
 
1 hour later…
4:33 PM
Helloo
I'm trying to port this algorithm: codegolf.stackexchange.com/a/168542/80214
Is this right? Try it online!
the main plotting part is {P5.G.ln {(2○⍵),1○⍵}1 k×⍵×a}¨⍳n
 
4:46 PM
@Razetime ln takes as arguments x1 y1 x2 y2 …, whereas you're giving x1 x2 y1 y2
you're also drawing everything in the range ¯1…1, so only 1 pixel is visible
 
hmm ok
{P5.G.ln {(2○⍵),1○⍵}¨1 k×⍵×a} for x1 y1 x2 y2
then {P5.G.ln 30×{(2○⍵),1○⍵}1 k×⍵×a} maybe?
 
also seems that python code has swapped n and k
 
ok small question
 
@Razetime with the ¨ and after the dfn because ln doesn't expect a nested argument (and also 30+ otherwise ¾ will still be off-screen)
 
I think {P5.G.ln {⍵○1 k×⍵×a}¨2 1} is cleaner?
then ↑ right?
hmm nothing is showing up
 
4:57 PM
@Razetime that creates a matrix [x1 x2 ⋄ y1 y2] whereas we need [x1 y1 ⋄ x2 y2]
also you're using for both the iteration and sin/cos there
 
{P5.G.ln↑30+{(2○⍵),1○⍵}¨1 k×⍵×a}
oh yeah thats terribly wrong
 
@Razetime missing 30×, but that works
@Razetime and you can definitely do something better than {(2○⍵),1○⍵} there as is a scalar
 
2 1 ○ ⍵
 
yep. and 2 1∘○¨ for golfing
 
5:01 PM
also: you can golf a←2×○÷n, and then inline it into the function
 
actually we dont even need that definition
 
@dzaima and since this is dzaima/APL, 2 1○ᑈ also works
also 30+30×30×1+ :| (also no space needed between 1 and k)
 
is there any shorter way to draw a circle?
like, are there aliases for 'center'P5.G.circle 30 30 60 60?
{P5.G.ln↑30×1+2 1○ᑈ1 n×⍵×2×○÷k}¨⍳k also this is what I finally got
 
@Razetime remove space between 1 and n; you can also golf 2×○÷k by 1 char
@Razetime the final 60 isn't doing anything
and with no left arg, the 3rd argument is the radius, so P5.G.circle 3⍴30 works
 
{n←⍺⋄P5.G.circle 3⍴30⋄{P5.G.ln↑30×1+2 1○ᑈ1n×⍵×2×○÷k}¨⍳k←⍵}
so this can be the final function
 
5:16 PM
15 mins ago, by dzaima
also: you can golf a←2×○÷n, and then inline it into the function
 
a isnt even in the function
it's not needed
 
@Razetime i meant the "golf" part. you already inlined it
 
ohhh
○2÷n?
 
yep
 
5:38 PM
posteddd
 

« first day (1374 days earlier)      last day (1263 days later) »