« first day (997 days earlier)      last day (1643 days later) » 

7:01 AM
I posted this answer to the is_gaussian_prime(z) challenge a bit ago, and I was wondering if there was any golfing that could still be done?
Changing to Extended won't help as the challenge doesn't allow prime factorization builtins and the like
Wait a minute, the answer's not even correct One moment
 
 
5 hours later…
ngn
11:58 AM
@Sherlock9 4| -> 4||
 
12:08 PM
Thanks!
 
 
1 hour later…
1:36 PM
@Adám Do you happen to know
a) How, on Mac RIDE, to change the point at which a line of code wraps from 80 characters?
b) Why `]box -trains=tree` isn't working?
Hope you're having a good Shabbat
 
ngn
2:31 PM
@Sherlock9 a guard is better than there
 
Noted. Thanks
 
ngn
@Sherlock9 28 bytes: {2=≢∪⍵∨⍳⍵}|+.×0∘∊⊃|{⍺⍵}3=4||
it turned out is even better :)
(⎕io←0)
 
@ngn Huh. What's going on here?
 
ngn
2:48 PM
@Sherlock9 ......{⍺⍵}... is like an if-then-else with swapped then and else: if 0∘∊ then 3=4|| else |
 
@ngn Huh. Alright, I'll include this in the post. Thanks
Okay how do I put this into TIO with my test cases? The full program idiom?
 
ngn
@Sherlock9 it's a train, you can assign it with f← just like any other function
 
Ah okay
Not sure this explanation is correct but hopefully it's fine
 
ngn
3:14 PM
@Sherlock9 looks good to me
 
 
2 hours later…
5:31 PM
@ngn what is the reasoning for having a⌹b ←→ (⌹b)+.×a instead of a+.×⌹b?
 
ngn
⋄⎕rl←1⋄n←3⋄a←?n n⍴0⋄b←?n n⍴0⋄⎕←(a⌹b)((⌹b)+.×a)(a+.×⌹b)
 
@ngn
┌────────────────────────────────────────────┬────────────────────────────────────────────┬────────────────────────────────────────┐
│¯0.5336025183   0.01914628213  0.03256685062│¯0.5336025183   0.01914628213  0.03256685062│0.1462980048  0.9026670489 ¯0.4139653465│
│ 0.07336985253  1.531237046    1.37654444   │ 0.07336985253  1.531237046    1.37654444   │1.822855274   1.597559387  ¯1.028418944 │
│ 2.548101392   ¯0.7141881787  ¯0.02078103805│ 2.548101392   ¯0.7141881787  ¯0.02078103805│0.04845015079 2.713018794  ¯0.7670039015│
 
ngn
@Cowsquack ^ the output didn't get formatted nicely, but i hope you can see that the first and second matrices are the same, and the third is different
or... did i misunderstand the question? are you asking why was designed that way (to return the left inverse rather than the right)? i have no idea
actually, i used wrong terminology above. ⌹b is both "left inverse" and "right inverse" of b. there's a theorem that says those always match.
however, matrix division could be "left" or "right" and for some reason dyalog have chosen "left".
 
6:32 PM
@ngn yes, my intended question was on the design choice
 

« first day (997 days earlier)      last day (1643 days later) »