« first day (1596 days earlier)      last day (1059 days later) » 

8:22 AM
what is the idiom for concatenation like ', ' f 'ab' 'cd' 'ef' → 'ab, cd, ef'?
 
Nothing better than {⊃(⊣,⍺,⊢)/⍵} I think
Also, "concatenation" in APL specifically means what x,y or x⍪y does. Your f is more commonly called as "join".
 
8:41 AM
@Bubbler @LdBeth Other approaches may see better performance than a custom (non-primitive) reduction:
      B←{⊃(⊣,⍺,⊢)/⍵}
      A←≢⍤⊣↓∘∊,¨⍥⊆
      t←⍴∘'a'¨?1000⍴8
      ]runtime -c "', 'B t" "', 'A t"

  ', 'B t → 3.1E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ', 'A t → 9.6E¯5 | -70% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
I must have looked at this before, because the solution from aplCart:
      C←{⊃⍪/1↓,(⊂⍺),⍪⍵}
      ]runtime -c "', 'B t" "', 'A t" "', 'C t"

  ', 'B t → 3.3E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ', 'A t → 9.7E¯5 | -71% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ', 'C t → 6.3E¯5 | -82% ⎕⎕⎕⎕⎕⎕⎕⎕
 
Not quite the same though...Bubbler's version also works on arrays of integers, i.e. 1 10 2 10 3 ≡ 10{⊃(⊣,⍺,⊢)/⍵}⍳3, whereas your train A doesn't -- but the APLcart one does too, so that's probably most preferable
 
Right, and C also works on higher ranks:
      '---'C(2 3⍴⎕A)(3 3⍴⎕C⎕A)(1 3⍴'xyz')
ABC
DEF
---
abc
def
ghi
---
xyz
You can fix B←{⊃(⊣⍪⍺⍪⊢)/⍵}
 
ah that's cool that you get that for free (but I suppose that's just the appeal of APL :P)
 
RGS
9:27 AM
Other than Adam's blue sky thinking, there's nothing about telling ⌺ to pad with something else other than 0s, right?
 
@RGS Nope, but that's another extension I have in mind.
 
RGS
Yeah, it would come in handy right now
 
@RGS It is fairly easy to use the left argument of the left operand to place alternative fills.
 
RGS
@Adám I'm not finding it that easy to write the generic behaviour I want, but I also just started thinking about it, so hopefully I'll come up with something.
 
@RGS This?
      {x←'x'⍨¨⍵ ⋄ (⍺↓x)←⍺↓⍵ ⋄ ⊂x}⌺3 3⊢3 4⍴⎕A
┌───┬───┬───┬───┐
│xxx│xxx│xxx│xxx│
│xAB│ABC│BCD│CDx│
│xEF│EFG│FGH│GHx│
├───┼───┼───┼───┤
│xAB│ABC│BCD│CDx│
│xEF│EFG│FGH│GHx│
│xIJ│IJK│JKL│KLx│
├───┼───┼───┼───┤
│xEF│EFG│FGH│GHx│
│xIJ│IJK│JKL│KLx│
│xxx│xxx│xxx│xxx│
└───┴───┴───┴───┘
 
RGS
9:34 AM
@Adám That's replacing with a constant value... but that might be a nice head start for me
I don't want to say exactly what I want because I want to get there by myself :P But when I find some solution I'll share it here so people can improve on it or suggest alternatives
 
@Adám That somehow reminded me of my take/drop enhancement proposal
 
@Adám what does the initial bit of the dfn do? from what I can tell it just replicates 'x' as many times as the window has major cells, no? I think the problem is I don't understand what is doing in there
 
RGS
@JosephAdams A⍨ is the constant function that always returns A
      {1}¨⍳10
1 1 1 1 1 1 1 1 1 1

      1⍨¨⍳10
1 1 1 1 1 1 1 1 1 1
 
@JosephAdams Not major cells, but elements.
 
9:41 AM
Ahh so it does basically do {(⊃⍴⍵)⍴'x'} ? which, now having written it, isn't actually shorter, as I had anticipated
 
RGS
I like how "middle" on APL Cart returns 2 results, one of them being related to the Cantor set xD
 
@JosephAdams It'd be (⍴⍵)⍴'x'
 
RGS
@JosephAdams Don't forget that f¨Y applies f to all scalars of Y.
@Adám aka 'x'⍴⍨⍴⍵ as per Adám's style guide :P
 
Ahh yes, just noticed a typo in my testing -- even on 3 3⍴1 I kept getting only 'xxx' but yeah, now I understand thanks @Adám and @RGS
 
@RGS Of course, but I wanted it to be parallel to what JosephAdams wrote.
 
RGS
9:47 AM
Yeah, I just like introducing entropy
 
And I welcome the extended advice on the style :D
 
@Adám Any updates on stencil + take/drop enhancements? Just curious because I found that almost a year passed since the discussion.
 
10:25 AM
@Bubbler Regarding the take/drop enhancements:
> Blocked by: Roger

∘ The specs are too complicated ("with at most one strictly positive element, and at most one strictly negative element").
∘ Just do it in two operations.
The stencil enhancement is a major feature, and we're not even considering adding any of those until 18.0 has been sorted.
 
sorted as in all the bugs fixed?
 
RGS
@rak1507 no no, as in sorted:
      {⍵[⍋⍵]}'18.0'
.018
 
lol
 
+
 
10:44 AM
@rak1507 Not just that. After "the disaster" we are focusing on having QAs and tracking code coverage for everything.
 
seems like the type of thing to do before releasing a major update, but better late than never
 
Exactly. And the disaster made it abundantly clear to management that our practices weren't good. So now we are prioritising quality over adding new features. We're also focusing on security aspects of our code.
 
Makes sense
 
+←1
 
RGS
11:35 AM
Which one is commute and which one is switch?
When distinguishing the cases f⍨ Y ←→ Y f Y and X f⍨ Y ←→ Y f X
Or are both names for the two things?
 
Commute is the general name for both. I prefer to call the monadic "self" and the dyadic "switch".
 
RGS
Self "should" be the name for f⍨ Y ←→ Y f Y and then either switch or commute would be fine for the other case.
@xpqz I have been enjoying your book. Let me know if you think I'm getting too opinionated when reviewing it.
 
11:54 AM
@Adám - "The Disaster"? Should I even ask what that was?
 
12:07 PM
@RGS :D -- no, opinionated is good -- you're making it better.
Brings back memories of writing my PhD thesis.
 
RGS
12:55 PM
How so?
 
1:05 PM
@RGS Someone checking my every comma, and making sure I've justified every statement. The application of rigor.
 
RGS
xD
I'll take that as a compliment 🙃
 
Absolutely.
 
 
2 hours later…
RGS
2:48 PM
Does someone understand what is going on?
      {⍵,w[pw]}¨⍺
┌─┐
│U│
└─┘

      ,∘w[pw]¨ ⍺
SYNTAX ERROR
      ,∘w[pw]¨⍺
          ∧
is ,⊂'' and w[pw] is a single character.
 
@RGS it's parsed as (,∘w)[pw]¨ and not ,∘(w[pw])¨ apparently
 
RGS
@dzaima how'd you figure that..?
 
actually maybe not ,∘(w[pw])¨ exactly, as the pointer differs
 
RGS
Parenthesising indexing makes it work indeed.
      ,∘(w[pw])¨⍺
┌─┐
│U│
└─┘
 
2:52 PM
well, what matters is that it's not evaluated as ,∘(w[pw])¨, as that does actually work
 
RGS
damned binding strength.
 
Damned bracket indexing.
@RGS ∘w is 5 while w[ is 4
 
@dzaima Why? Who is to say that Dyalog's choices of binding strengths are the right choices?
 
RGS
I don't care
that was the final thing I needed
me happy
me go eat
 
2:54 PM
@RGS … to give up on bracket indexing?
 
RGS
@Adám no, to finish the problem I was trying to solve
 
@dzaima APL2 binds w[ stronger than w w while Dyalog lets w w be stronger than w[. What does dzaima/APL do?
 
@Adám syntax-parsing wise I had a pseudo-goal to match Dyalog as closely as possible. But here brackets not binding stronger is purely useless
after stranding, [] binds directly to the previous token and nothing else
 
@dzaima How about in ×∘-/[1]3 2?
 
@Adám binds to the / - [/, [1], 3 2][/[0], 3 2]
 
2:59 PM
@dzaima And ×∘(-/)[1]3 2?
 
it doesn't even get a chance to see what's before the /
@Adám in dzaima/APL, (-/) is a single "token", so it binds to that
 
So that differs from Dyalog too.
 
right. it of course differs in all cases of dyadic operators directly before bracket axis
(and i guess function bracket axis makes the behavior not entirely useless)
 
@dzaima 1 2 3∘.+/[1]3⍴¨⍳3?
 
@Adám ∘.+(/[1]). It's all operator expressions, not just dyadic ones of course
 
3:04 PM
And ngn/apl differs from both Dyalog and dzaima. Again shows how bad brackets are.
 
@dzaima (but for f/[1] dzaima/APL requires f(/[1]) and disallows (f/)[1], so this is what you do want)
 
I'm myself guilty of using bracket indexing to avoid parens in things like 'abc',var[i],'def', and to select multiple cells, but I do think there are only two really justified use cases of bracket axis left: making be first axis oriented, and merging axes with monadic ,[ax]
 
brackets are still miles more pretty than the alternatives though
 
You'll find that Aaron Hsu uses I for Select, and doesn't even bother stating its definition. He takes it for granted.
 
i mean, makes sense. It's like if if didn't exist in C or something
 
3:14 PM
When I was lobbying for , I used to start my code by defining (well, Unicode's ) but unfortunately I can't do something that elegant with
Maybe I'll just use Aaron's naming and start all code with I←⌷⍨∘⊃⍨⍤0 99
And then V←I⍨∘⍒⍨ ⋄ A←I⍨∘⍋⍨
Another one I do lately is L←{</⍋18(⊃⊢/'.'⎕VFI⊃⍬⍴1⌽#⎕WG'APLVersion'):⎕C⍵⋄819⌶⍵}
Heh, maybe I should make a tiny "Adám's polyfill" library
@user4069 Hello.
 
@Adám what on earth is that!
 
@rak1507 Version-agnostic polyfill for as "lowercase".
 
ah, cool
 
The bulk is just to determine if we're on 18.0+
Other candidates: R←⊢⍤⌿ ⋄ E←⊢⍤⍀
Or maybe they should be called f and t for visual similarity?
Not that long ago, Morten suggested for ⊢⍤⌿ and for ⊢⍤⍀
 
@Adám f would probably conflict some. And I don't think losing readability for visual similarity is at all worth it (I don't even think a⍀b is common enough to warrant a character in a library)
 
3:27 PM
True, and it also conflicts with my naming convention.
I, V and R, but then comes with auto-dimension, and what would I call that then?
Maybe ⊢⍤⌿ can be C for Compress, as that is by far the most common usage. Or F for Filter (and a little bit of visual similarity)?
 
3:49 PM
Candidate:
⍝github.com/abrudz/polyfill
I←⌷⍨∘⊃⍨⍤0 99
V←I⍨∘⍒⍨
A←I⍨∘⍋⍨
F←⌿⍨⍨
R←{i←(¯1 0⍸⍺)ׯ1*⍺=¯1⋄⍵⍴⍨⌈@{0=i}⌊@{1=i}((×/⍴⍵)÷×/⍺/⍨0<⍺)@{0>⍵}⍺}
Ö←{⍺←{⍵⋄⍺⍺}⋄n←0>k←⌽3⍴⌽⍵⍵⋄(n/k)+←n/d←|≡¨3⍴⍵⍺⍵ ⍵⋄3 4∊⍨⎕NC'⍺':⍺⍺{⍵⍵<|≡⍵:∇¨⍵⋄⍺⍺⍵}(⊃k)⊢⍵⋄⍱/b←1↓k<d:⊢⍺ ⍺⍺⍵⋄</b:⊢⍺∘∇¨⍵⋄>/b:∇∘⍵¨⊢⍺⋄∧/b:⊢⍺∇¨⍵}
 
what is that last one
 
Depth.
 
oh right, yeah, it would be
how about also sane ¨?
 
Good point:
ë←{⍺←⊢⋄0∊⍺,⍥⍴⍵:(⍺⌈⍥⍴⍵)⍴⎕NS⍬⋄×⎕NC'⍺':⍺⍺⍺¨⍵⋄⍺⍺¨⍵}
Ad-hoc naming convention: ¨ on a lowercase letter for monadic op; ¨ on an uppercase letter for dyadic op.
 
4:12 PM
Another commonly needed one is the template string:
S←'\$\{[^$}]+\}'⎕R{⍕⍎2↓¯1↓⍵.Match}⍣≡
 
 
1 hour later…
5:32 PM
@Adám Hi, thank you for the shout-out. I'm at the level of discovering ⍳10 :) and looking for a beginner's tutorial. My interest is purely personal, not professional. I have some experience in the Wolfram language. Your recommendation?
 
5:45 PM
@MarekKowalczyk I recommend either asking me for a personalised intro, or choose anything from the section of apl.wiki/Learning_resources that fits you ("non-programmer" or "programmer unfamiliar with APL").
 
6:30 PM
@dzaima How would you define a Rank operator that doesn't call its function operand when an argument is empty?
E.g. {,⍵}⍤0⊢⍬ should return 0 1⍴*nonproto* but how do you find the final shape?
 
@Adám I wouldn't. For it, you kind of need behavior for empty arrays
if I had to have a Rank operator that doesn't call the function on empty arguments (and doesn't error), it'd just not merge the output ever
 
It could actually work. Use ¨ when you want to avoid prototype issues and ⊂⍤f⍥⊃⍤0 when you want to work on the prototypes.
Even better as f⍢⊃⍤0
Is this what BQN does?
 
BQN does proper fills for /˘
 
Sure, but /¨?
 
@dzaima wait, no, BQN doesn't ever call functions that could possibly have side-effects to compute fills. If it really needs fills, it may check if the function is pure, and evaluate then, otherwise it just errors
 
6:41 PM
In BQN, is it possible to distinguish "" and ⟨⟩ at all?
 
@Adám sure
 
@dzaima How comes 3⥊""-@ works but 3⥊⟨⟩ fails?
 
@Adám - calculates fills
 
Doesn't ""-@ give ⟨⟩?
Ah, I think I get it.
There are 3 types (at least) of empty vectors. Numeric, character, and none.
 
the BQN spec for fills is "here's a list of cases where fills must be computed (which include basic arith and structural builtins, and probably some others), and you can do whatever you want in the rest of the cases"
 
6:51 PM
BQN CMC: Dyadic but consider ⟨⟩ and ↕0 and "" as distinct.
 
should the fills be checked at any leaf empty array? do fills of fills need to be considered?
 
I didn't realise you could have nested fills. I thought it was more like J.
@dzaima Yes. Yes.
APL CMC: Dyadic but consider and '' and 0⍴⎕NULL as identical.
 

« first day (1596 days earlier)      last day (1059 days later) »