« first day (1063 days earlier)      last day (1581 days later) » 

9:46 AM
CMCs: Modern equivalents of the 6 Iverson notations:
\A,u,B\
\A,U,B\
\a,U,b,\
\\A,u,B\\
\\A,U,B\\
\\a,U,b\\
(capital letters are matrices, lowercase letters are vectors)
 
 
2 hours later…
11:52 AM
@Adám Some explanation of the mathematical notations on the article would help, especially mu and nu functions(?)
 
@Bubbler Those are simply the elements of ; see here
 
12:15 PM
So \'abc',0 1 0 0 1 1,'def'\ ≡ 'adbcef', right?
Also, can I use three predefined variables for a, u, b?
 
@Bubbler Yes.
@Bubbler Absolutely, or even better, Xv Av Yv.
 
1:05 PM
The basic \Xv,Av,Yv\ would be (Xv,Yv)[⍋⍋Av] or (⊂⍋⍋Av)⌷Xv,Yv
 
@Bubbler Well done. The next matrix ones are tricky though. Ideally, we'd want to put a single operator that handles all the column cases on APLcart. (The row cases are ⍤1 of that.)
 
1:18 PM
⋄Xm Av Ym←(3 3⍴'abcdefghi') (0 1 0 0 1 1) (3 3⍴'ABCDEFGHI')⋄⎕←Xm(Av{(⊂⍋⍋⍺⍺)⌷[1]⍺⍪⍵})Ym
 
@Bubbler
abc
ABC
def
ghi
DEF
GHI
 
⋄Xm Av Ym←(3 3⍴'abcdefghi') (0 1 0 0 1 1) (3 3⍴'ABCDEFGHI')⋄⎕←Xm(Av{(⊂⍋⍋⍺⍺)⌷[1]⍺⍪⍵}⍤1)Ym
 
@Bubbler
aAbcBC
dDefEF
gGhiHI
 
@Adám I guess these handle \Xm,Av,Ym\ and \\Xm,Av,Ym\\ ?
 
@Bubbler Sure. Leading axis orientation FTW. Btw, you don't need [1]. By "matrix ones are tricky" I meant Am.
 
1:23 PM
I see.
⋄Xm Av Ym←(3 3⍴'abcdefghi') (↑(0 1 0 0 1 1)(1 1 0 0 1 0)(0 1 1 0 1 0)) (3 3⍴'ABCDEFGHI')⋄⎕←(⍋⍤1⍣2⊢Av)⊃¨∘⊂⍤1⊢Xm,Ym
 
@Bubbler
aAbcBC
DEdeFf
gGHhIi
 
Is this \Xm,Am,Ym\ ?
 
@Bubbler Sure looks like it. Impressive. And then that ⍢⍉ would be the \\ version.
 
Yeah, I guessed we need a transpose somewhere for \\ ?,U,? \\ .
 
@Bubbler Hm, wait a minute, may it is possible without transposing.
If we make Xm,Ym into Xm⍪Ym
 
1:39 PM
And the formula seems to work with Xv and Yv too
⋄Xv Am Yv←('abc') (↑(0 1 0 0 1 1)(1 1 0 0 1 0)(0 1 1 0 1 0)) ('ABC')⋄⎕←(⍋⍤1⍣2⊢Am)⊃¨∘⊂⍤1⊢Xv,Yv
 
@Bubbler
aAbcBC
ABabCc
aABbCc
 
@Adám We can reduce the number of , but it'd be hard to eliminate because we need to handle U in different direction.
 
@Bubbler Ah, yes, U is transposed in the vertical cases.
⋄Xm Am Ym←(3 3⍴'abcdefghi') (⍉↑(0 1 0 0 1 1)(1 1 0 0 1 0)(0 1 1 0 1 0)) (3 3⍴'ABCDEFGHI')⋄⎕←⍉(⍋⍤1⍣2⍉Am)⊃¨⍤¯1⊂[1]Xm⍪Ym
 
@Adám
aBc
AEC
dbF
gef
DHI
Ghi
 
@Bubbler ^ only two s.
 
1:50 PM
Oh wow.
Now I'm digging into the backslash function, and it looks promising.
\Xv,Av,Yv\ -> Xv(Av{(⎕IO+⍺⍺)⊃¨((~⍺⍺)\⍺),¨(⍺⍺\⍵)})Yv
\Xm,Av,Ym\ -> Xm(Av{(⎕IO+⍺⍺)⊃¨⍤1⊢((~⍺⍺)\⍺),¨(⍺⍺\⍵)})Ym
\\Xm,Av,Ym\\ -> Xm(Av{(⎕IO+⍺⍺)⊃¨⍤0 1⊢((~⍺⍺)⍀⍺),¨(⍺⍺⍀⍵)})Ym
 
@Bubbler Btw, I've found a somewhat longer way to enable boxing, which lessens overhead with an order of magnitude:
 
2:09 PM
Erm, the backslash has the same problem on handling vertical U.
\Xm,Am,Ym\ -> Xm(Am{(⎕IO+⍺⍺)⊃¨⍤1⊢((~⍺⍺)\⍤1⊢⍺),¨(⍺⍺\⍤1⊢⍵)})Ym
^ also works for Xv and Yv
 
2:21 PM
\\Xm,Am,Ym\\ -> Xm((⍉Am){⍉(⎕IO+⍺⍺)⊃¨⍤1⊢((~⍺⍺)\⍤1⍉⍺),¨(⍺⍺\⍤1⍉⍵)})Ym
^ also works for Xv and Yv
^ which is essentially Xm((⍉Am)op⍢⍉)Ym where the op is single-backslash version
All in one: Try it online!
 
We need an Over hyperator.
 
I also once thought about "hyperator" when I was writing a dop that should map over all of ⍺ ⍺⍺ ⍵ when they are vectors
 
Well, now NARS2000 has them.
 
@Adám Do you mean hyperators?
 
2:37 PM
@Bubbler Yeah.
 
Huh. Do they have a dedicated syntax?
 
@Bubbler No, simply indicated by ⍺⍺⍺ and/or ⍵⍵⍵
 
That sounds like an opportunity for a higher-order function with unlimited curries
...though writing ⍺⍺⍺⍺ and ⍺⍺⍺⍺⍺ and so on would be crap
 
@Bubbler What?
@Bubbler If it wasn't for most (?) APLs' allowing adjacent identifiers, ⍺4 and ⍺5 could work.
But then again, who really needs superators and ultrarators? See also dfns.notes.hyperators.
Hm, the bot should be able to print that…
⎕←⎕SE.notes.hyperators
 
@Adám
Hyperators
¯¯¯¯¯¯¯¯¯¯
Functions take arrays as arguments;
¯¯¯¯¯¯¯¯¯      ¯¯¯¯¯¯    ¯¯¯¯¯¯¯¯¯
Operators take functions (and arrays) as operands;
¯¯¯¯¯¯¯¯¯      ¯¯¯¯¯¯¯¯¯                 ¯¯¯¯¯¯¯¯
Q: What takes operators?

Hyperators take operators (and functions (and arrays)) as hyperands.
¯¯¯¯¯¯¯¯¯¯      ¯¯¯¯¯¯¯¯¯                                 ¯¯¯¯¯¯¯¯¯
Clearly, this is a never-ending sequence.


A proof of the (need for the) existence of hyperators:

0. We like to write tools that deal with  APL entities (arrays, functions, oper-
 
2:57 PM
Random fact: in Dyalog, ⍺⍺⍺⍺⍺ successfully parses into ⍺⍺ ⍺⍺ ⍺
 
@Bubbler Exactly, that's what I mean. There are other, even worse cases, like a1←1 ⋄ 0a1≡0 1 and e1←1 ⋄ 0e1≡0
 
 
2 hours later…
4:56 PM
@Bubbler May I add these to the APL Wiki and APLcart?
 
 
5 hours later…
9:43 PM
I don't think I've ever used two "interesting" APL features in a single answer:
2
A: Reversing and Shifting

AdámAPL (Dyalog Unicode), 20 bytesSBCS Full program. Prompts for the string, then times, then instruction: + for reversal 1 for left shift any other character for right shift (⍎⍕⊃¯1,⍨⍞∩'+1')⌽⍣⎕⊢⍞ Try it online! ⍞ prompt for string ⊢ on that, do the following: ⎕ prompt for times (…)⌽⍣ app...

∘ mixed type list 'r',¯1
∘ varying type result from (number/function)
 
 
2 hours later…
11:59 PM
I guess this is the place to ask this: what is usually shorter in code golfs, APL, J or K?
 

« first day (1063 days earlier)      last day (1581 days later) »