« first day (559 days earlier)      last day (2088 days later) » 

ngn
7:39 AM
@Adám first I thought it might belong in your answer, along with 1⊥ and 0⊥ but it's not about /-avoidance, so I'll post it separately
 
ngn
7:53 AM
0
A: Tips for golfing in APL

ngnUse ⊥ to combine multiplication with addition (a×b)+C -> a⊥b,C (C)+a×b -> a⊥b,C Assumptions: a and b are terms that don't require further parentheses when used as a left argument C is an expression that may need parentheses when used as a left argument a b C evaluate to numeric scalars

 
 
6 hours later…
1:44 PM
@Adám @ngn hey guys, can anyone give me a hand here? I'm trying to count how many equal elements a vector has. I know I can use but the usage is weird and I can't seem to get it right >.>
 
@J.Sallé What exactly should 2 7 1 8 2 8 1 8 2 8 give?
 
@Adám ultimately, it should return 8. I'm trying to solve this and I almost got it, actually
I managed to use after all, but I'm still having a problem getting the value I want
⍞←{⍺}⌸{(∊∘.<⍨⍵)/∊∘.×⍨⍵}9 7 10 9 7 8 5 10 1
 
@J.Sallé 90 63 70 56 72 80 45 35 50 40 9 7 10 8 5
 
I need to get that 90 now, but nothing I do to returns that D:
BTW is the hacky way I did the vector multiplication any decent? I'm still working out the quirks of the dot op
 
⍞←(⊢⊃⍨∘⊃∘⍒1⊥∘.=⍨)2 7 1 8 2 8 1 8 2 8
 
1:57 PM
@Adám 8
 
⍞←((1 2⊃⍒⌷¨⊂),⍨∘≢⌸)2 7 1 8 2 8 1 8 2 8
 
@Adám 8
 
@Adám Can I just put that in my Dfn up there replacing the whole thing?
Apparently so, yeah
 
@J.Sallé How about:
⍞←(∊⍳∘≢↓¨⊢×⊂)9 7 10 9 7 8 5 10 1
 
@Adám 63 90 81 63 72 45 90 9 70 63 49 56 35 70 7 90 70 80 50 100 10 63 72 45 90 9 56 35 70 7 40 80 8 50 5 10
 
2:01 PM
I'd tried doing the 1⊥∘.= thing 'cause I remeber you taught that to me a while back, I just couldn't make it work
 
⍞←((1 2⊃⍒⌷¨⊂)(,⍨∘≢⌸∘∊⍳∘≢↓¨⊢×⊂))9 7 10 9 7 8 5 10 1
 
@Adám 90
 
@Adám I'll see if I can understand that >.>
 
2:18 PM
@Adám is there any particular reason you did (1 2⊃⍒⌷¨⊂)(,⍨∘... instead of (2 1⊃⍒⌷¨⊂)(,∘...?
I already figured it out
 
2:41 PM
@J.Sallé Better
 
@Adám okay cool, I'll post that then :D
 
3:34 PM
0
Q: Length error while creating a dfn function in APL to check for anagrams

okty I am a beginner in APL and am writing a dfm function to check whether two strings are an anagram of one another. The method I thought of was: {⍵[⍋⍵] ≡ ⍺[⍋⍺]} However, it returns '0' for 'ALBERT EINSTEIN' and 'TEN ELITE BRAINS' that are anagrams. I tried to check why: a ← 'ALBERT EINSTE...

 
 
1 hour later…
ngn
4:49 PM
@Adám @J.Sallé {⌈/⊢/⊣¨⌸∊⍵}⍳∘≢↓¨⊢×⊂
I have a feeling of deja vu about this problem. A similar solution is probably present somewhere in Dyalog's email archives.
 
@ngn wizardry!
I'll check that out
 
 
1 hour later…
6:07 PM
@ngn could you explain the last bit ⌈/⊢/⊣...? I don't think I understand what's going on here
Oh nevermind, I think I was interpreting the grouping wrong
 
ngn
@J.Sallé ⊣¨⌸ creates a matrix in which each row corresponds to a unique product
 
@ngn yeah, that's what I figured. I was indeed grouping it wrong
 
ngn
you have as many copies of it as there are in the pairings, and the rest of the row is filled with 0s
so, the last column of that matrix will contain the most numerous ones
 
You can also do ⊢⌸⍨
 
ngn
@H.PWiz well, it's the same byte count
so, ⊢/ gets the last column, but it also has zeroes because of the padding, which we must discard
note that the challenge says that the input numbers are positive, so their product can never be 0
 
6:15 PM
That's why we have to do the ⌈/ then
 
ngn
⌈/ makes sure we choose an arbitrary product, avoiding the paddings
the expression for the pairwise products could be io-independent, if that matters: ¯1↓¨⊢×,\
 

« first day (559 days earlier)      last day (2088 days later) »