« first day (1846 days earlier)      last day (809 days later) » 

12:04 AM
@Adám im glad i could join :D
 
 
5 hours later…
4:52 AM
If t is of any decent size, I think the old-school shift-and-compare technique is actually the fastest:
cmpx  's(≢≠⊆⊢)t' 's{+/0 1⍷⍺=⍵,⍺}t' 's{{+/⍵>¯1↓0,⍵}⍺≠⍵}t'
  s(≢≠⊆⊢)t            → 1.1E0  |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  s{+/0 1⍷⍺=⍵,⍺}t     → 8.6E¯1 | -24% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  s{{+/⍵>¯1↓0,⍵}⍺≠⍵}t → 1.6E¯2 | -99% ⎕
 
 
3 hours later…
7:23 AM
@PaulMansour 0, is (relatively) expensive. Using a pair-wise reduction is faster. {+/2</1,⍨⍺=⍵} is probably as fast as it gets:
      cmpx's{{+/⍵>¯1↓0,⍵}⍺≠⍵}t' 's{+/2</1,⍨⍺=⍵}t' ⊣ s←',' ⊣ ⎕←≢t←',XY'[/⍨?1e6⍴3]
2001348
  s{{+/⍵>¯1↓0,⍵}⍺≠⍵}t → 1.4E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  s{+/2</1,⍨⍺=⍵}t     → 1.1E¯4 | -22% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
8:03 AM
      (+/⊢×(⌽10*⍳⍤≢))5 5 6 5 5
55655
is there a way to get rid of the inner parens?
 
@PyGamer0 ×∘⌽ or ⌽⍤*
But better: +/⌽×10*⍳⍤≢
And best: 10∘⊥
 
⋄ +/⌽×10*⍳⍤≢
 
@PyGamer0
  ┌─┴─┐
  / ┌─┼────┐
┌─┘ ⌽ × ┌──┼─┐
+       10 * ⍤
            ┌┴┐
            ⍳ ≢
 
 
1 hour later…
9:08 AM
@Adám why do you have the ∘ there? it seems to work even without
 
10∘⊥ is a function
10⊥ is not
 
ahhhhh... fair
 
 
3 hours later…
11:41 AM
How can I multiply one row of a matrix by ¯1 most easily? Now I used an inner product with a pre shaped matrix
2 2 ⍴ (1 0 0 ¯1) +.× ...
 
(3 3⍴⍳9)[1;]ׯ1
¯3 ¯4 ¯5
this is what i would do, but you only get the row as output.
x←(3 3⍴⍳9)⋄x[1;]×←¯1⋄x
0 1 2
¯3 ¯4 ¯5
6 7 8

this works but can be modified a lot
 
Shame we don't have the leading axis agreement. Otherwise ¯1 1 1 × 3 3⍴⍳9 would work
 
Yes @BrianBED that was my original plan but a lot of code and reassigning caused me to try inner product. But that is also not optimal
 
⋄ ¯1 1 1 ×⍤0 1⊢ 3 3⍴⍳9
 
@FawnLocke exactly
 
11:51 AM
@FawnLocke
¯1 ¯2 ¯3
 4  5  6
 7  8  9
 
That works in the meantime
 
:)
 
That is very nice
 
i made a fairly cute wordle-related thing that finds the best opener
words←↑0⎕json↑,/⊃⎕nget '/home/palaiologos/Desktop/wordle.json' 1
letters←⊃¨freq←↑{(↓⍵)[⍒⍵[;2]]}¨{⍺,≢⍵}⌸¨↓⍉↑words
norep←{⍵⌿⍨⍵≡∘∪⍤1⊢⍵}words
scores←{+⌿⍸⍤1⊢⍵(=⍤0 1)letters}¨↓norep
(↓norep)[⊃⍒scores]
i really like the use of rank here and i was wondering if i could somehow make scores use rank instead of map
 
@Richard ¯1×@rowNum or even -@rowNum
 
12:01 PM
@Adám does that not only return the row?
o no it changes the row
 
@KamilaSzewczyk Speaking of Wordle. I made this, using the classic PDE utility (available from APLcart):
      ⎕IO←0
      PDE←{((≢⍺)⍴⍋⍋⍺⍳⍺⍪⍵)∊(≢⍵)⍴⍋⍋⍺⍳⍵⍪⍺}
      'SENDS'{'⬛🟨🟩'[(2×~n)+(n⍀n⌿⍺)PDE⍵⌿⍨n←⍺≠⍵]}'TAMES'
⬛🟨⬛⬛🟩
 
wait, which one is the main word here?
I presume omega
it seems fairly difficult to do in a simpler way since one of the suggested letters (yellow) that appear in the word may have been picked already
 
Yes, is the target and is the guess.
 
      'SAADS' wslv 'TAMES'
⬛🟩⬛⬛🟩
      'SENDS' wslv 'TAMES'
⬛🟨⬛⬛🟩
is this expected behaviour?
anyway, my initial attempt is wslv←{'🟩🟨⬛'[↑+/1 2 3×g y (~g∨y←(∨/¨(⍵/⍨g←⍺=⍵)∘=¨⍺)≠⍺∊⍵)]}.
can be improved a lot.
mine seems to be ever so slightly faster //edit: it's 50% slower on larger input
 
12:28 PM
@ad
@Adám . I do not fully understand the @ function. How do you make the difference of a row and an item?
(1@2 2)4 3 ⍴⍳12 changes row 2 and not item[2;2]
(¯1×@2)4 3⍴⍳12
gives the error 'missing right argument'
so here I am not addressing the row probably
 
1:24 PM
@Richard Your issue here is that ¯1× is not a complete function. The left operand to @ must be a function, or (as a shortcut) an array
to make it a function, either bind or make a train: ¯1∘× or ¯1×⊢
the indexing semantics are similar to the indexing function ⍺⌷⍵ where each element in is a trailing axis selection in
↑ oops above is a bit of a mistake
looks like it's "flipped" relative to :
⋄ 2⌷4 3⍴⍳12
 
@RikedyP 4 5 6
 
⋄ (¯1∘×@2)4 3⍴⍳12
 
@RikedyP
 1  2  3
¯4 ¯5 ¯6
 7  8  9
10 11 12
 
⋄ 2 1⌷4 3⍴⍳12 ⍝ Select 2nd row 1st column
 
@RikedyP 4
 
1:28 PM
⋄ (¯1∘×@(⊂2 1))4 3⍴⍳12 ⍝ Modify 2nd row 1st column
 
@RikedyP
 1  2  3
¯4  5  6
 7  8  9
10 11 12
 
⋄ (⊂2 1)⌷4 3⍴⍳12 ⍝ Select rows 2 and 1
 
@RikedyP
4 5 6
1 2 3
 
      (-@2)4 3⍴⍳12
 0  1  2
 3  4  5
¯6 ¯7 ¯8
 9 10 11
 
And excellent point from @xpqz; last thing worth noting is that (-@2) will be either dyadic or monadic depending on the function call, whereas (¯1∘×@2) is a derived monadic function
 
1:31 PM
(⎕IO←0)
 
2:09 PM
@KamilaSzewczyk Yes, why not? In the first case, A and final S are correctly positioned. In the second case, the first S is not needed, E is in the wrong spot, and the final S is all-correct.
 
2:46 PM
How can I make a windowed reduction play nicely in a tacit expression? I want {⌈/2(-⍨÷⊣)/⍵} fully tacit.
I'm sure I'm staring at the obvious without seeing it
 
@xpqz A windowed reduction is a simple dyadic function: ⌈/2(-⍨÷⊣)/⊢
 
Could have sworn I tried that.
 
⋄ {⌈/2(-⍨÷⊣)/⍵}⍳12
 
@PyGamer0 1
 
3:17 PM
can you make a recursive function tacit???
f←{⍵=0:f⍵-1⋄0}
simple example
 
@BrianBED No.
 
ok good to know
 
However, you might be able to make it iterative using
 
Oo wdym?
 
-∘1⍣(0≠⊣)
 
3:22 PM
@Adám should it be = in there? seems like ≠ doesn't work
also, super neat btw
 
@BrianBED I had = at first, since that makes more sense, but then I noticed that your recursive function returns 0 only when ⍵≠0.
 
oh my example might be wrong then
 
 
3 hours later…
5:57 PM
@Adám in APLCart, I don't think aplcart.info?q=centering%20text%20line works as suggested -- it seems to flush right, rather than centre.
      20(⊢↑⍨∘-∘⌊2÷⍨+∘≢)'hello'
┌→───────────┐
│       hello│
└────────────┘
 
@xpqz ⋄ 20(⊢↑⍨∘-∘⌊2÷⍨+∘≢)'Hello' ⋄ 20⍴'|'
 
@Adám
       Hello
||||||||||||||||||||
 
If you actually want those trailing spaces, it should be fairly obvious to add ⊣↑
 
Ah, I see, sorry.
 
 
3 hours later…
8:30 PM
@Adám Brian on Discord: "OMG NO ONE TOLD ME THERE'S AN APL DISCORD"
Time to add this link to the room description?
 
room topic changed to The APL Orchard: apl.chat ― Learn, teach, ask, code, golf, & discuss usage. See apl.wiki/APL_Orchard for access and info, aplcart.info for simple how-to questions. See also apl.wiki/Chat_rooms_and_forums [apl] [array-manipulation] [j] [tips]
 
Awesome
 
 
2 hours later…
10:20 PM
Hey everyone. Long time.
Quick question: how would you remove the duplicate of ⍳9?
(∨⌿0=3 5∘.|⍳9)/(⊢⍳9)
 
You can a) assign it, b) apply a dfn to it, c) apply a tacit function to it.
 
 
1 hour later…
11:42 PM
@PatrickVillela guess this is what you want ⊢/⍨(∨⌿0=3 5∘.|⊢)
to prevent / been treated as an operator, add to it
 
@LdBeth That's not enough. You need ⊢⍤/⍨ or (/⍨)
 
right
(/) won't work though
 
Nope. But (∨⌿0=3 5∘.|⊢)⊢⍤/⊢ will.
But at that point, you might as well write {(∨⌿0=3 5∘.|⍵)/⍵}⍳9
Btw, ∨⌿0= is (here) the same as 0∨.= which saves a parenthesis, while making it possible for the interpreter to optimise.
 

« first day (1846 days earlier)      last day (809 days later) »