« first day (2324 days earlier)
← previous day
next day →
last day (333 days later) »
Adám
1:25 PM
Odds & Evens (APL Quest 2019-10)
►
5 hours later…
1234
5:59 PM
Remove nth index column from a matrix
rm ← {(((⍵-1)∘↑⍤1)⍺ ), (⍵∘↓⍤1)⍺ }
m1
┌→────┐
↓1 2 3│
│4 5 6│
└~────┘
m1 rm 2
┌→──┐
↓1 3│
│4 6│
└~──┘
Any idea hw to shorten my rm function?
Adám
@1234 (Btw, press ctrl+k before posting for proper formatting)
1234
sorry..I just forget..
Adám
@1234
rm←{⍺[;⍵~⍨⍳≢⍉⍺]}
Btw, this works for removing multiple columns too.
@1234
rm←{⍺/⍨⍵≠⍳≢⍉⍺}
is shorter but only works for removing a single column. Amend to
rm←{⍺/⍨~⍵∊⍨⍳≢⍉⍺}
for removal of any number of columns.
1234
6:19 PM
nice
1234
6:30 PM
should APL have a primitive function to remove column or row from matrix, or higher rank array?
It seems to me it is very common operation.
Adám
It already has:
/
and
⌿
1234
Oh
this is why I'm here.. I have no idea what I'm doing.. :)
Adám
The left argument is a mask indicating which columns or rows, respectively, to
keep
.
1234
cool.
« first day (2324 days earlier)
← previous day
next day →
last day (333 days later) »
all rooms
Transcript for
Jun
6
Jun '23
7
Jun
8
The APL Orchard
apl.chat
― Learn, teach, ask, code, golf, & discuss usage. See
...
2
apl
array-manipulation
j
tips
join this room
about this room
00:00
06:00
12:00
18:00
all times are UTC
site design / logo © 2024 Stack Exchange Inc;
legal
mobile