« first day (2564 days earlier)      last day (85 days later) » 

9:35 AM
Apart from ]Profile/⎕PROFILE, what performance analysis tools do we have at hand?
More particularly, I'm wondering if there is tooling to help bulk analyze the execution times of lines in dfns/tradfns.
 
9:54 AM
@B.Wilson ⎕PROFILE should give you all the actual information, while the user command provides some statistics, but it should be rather trivial to do you own analysis of ⎕PROFILE's data using some powerful numerical array language, if only one was at hand…
 
@Adám Oh, you must be talking about that obscure language that's not Numpy.
Okay. I'll go RTFM on ⎕PROFILE. Cheers.
 
 
3 hours later…
1:00 PM
Welcome to APL Quest, 2023-5! Today's quest is Risky Business:
> In the board game Risk, attacker and defender each roll a number of dice. The resulting rolls are then individually compared from highest to lowest. If the attacker's die value is greater than the defender's, the defender loses one army. If the defender's die value is greater than or equal to the attacker's, the attacker loses one army. If one player rolls more dice than the other other player, the additional dice are not considered in the evaluation. We generalize by allowing any number of dice for attacker and defender, and any integer value dice rolls.
> • takes a non-empty, descending integer vector left argument representing the attacker's dice rolls
• takes a non-empty, descending integer vector right argument representing the defender's dice rolls
• returns a 2-element vector where the first element represents the number of armies the attacker lost and the second element represents the number of armies the defender lost.
 
I tried to make a different solution, compared to my entry of 1 year ago. But got a little bit stuck
 
forgot to do this one, but for the contest I had (⌊⍥≢⍴⊣)(≤,⍥(+/)>)(⌊⍥≢⍴⊢) (can't remember how it works), really dislike the repetition but I vaguely remember not being able to come up with anything else
 
It is quite fine to use your entry.
 
I had +/0 1∘.=(>/⌊⍥≢↑⍉⍤↑⍤,⍥⊂)
 
@RubenVerg The problem is that you want an argument being used in an operand. You need explicit code for that.
 
1:03 PM
wdym?
 
@rabbitgrowth That's… intense. Let's make it more so: Get rid of the paren!
@RubenVerg See "Restrictions and Extensions" at dfns.dyalog.com/n_tacit.htm
 
( (+/,+/∘~)((⌊⍥≢)↑⊢) ≤ ((⌊⍥≢)↑⊣))
not finished yet
 
So now you work directly in tacit? Love it!
 
a lot of duplicate things
shouting for ⍥
 
Yes and no. Same issue @RubenVerg has.
@RubenVerg {L←(⍺⌊⍥≢⍵)∘↑ ⋄ ⍺(≤,⍥(+/)>)⍥L⍵}
Or {⍺(≤,⍥(+/)>)⍥((⍺⌊⍥≢⍵)∘↑)⍵} of course.
 
1:09 PM
@Adám oh no, I wasn't intending it to be that way :(
Figured it out: +/0 1∘.=⌊⍥≢>/⍤↑⍉⍤↑⍤,⍥⊂
 
Yup.
 
here an {(⍺⍹⍵)⍶(⍵⍹⍺)} operator would be useful
(or maybe with the arguments swapped, not sure which is best)
 
Yes, that's a relatively common request, and yes, the followup design question always comes next.
Here's a fun one: +/0 1∘.=1 1⍉∘.>
A bit wasteful, but the beauty gained…
 
Nice!
The followup design question being whether to swap the arguments?
 
Everyone understands how it deals with shortening down to the shortest length?
@rabbitgrowth Yes.
I think I lean towards {(⍵⍹⍺)⍶(⍺⍹⍵)}
 
1:15 PM
yeah I suppose the right argument being the straight one and the left argument being the reverse one makes more intuitive sense
 
@Adám no
 
I thought of it as follows: Conceptually X g Y is X∘g Y and so the pre-processing the right argument should be with ⍺∘g and the left argument with ⍵∘g
@Richard So, the outer product gives us a rectangle with one long and one short side, right?
 
yes
 
The diagonal has the results for corresponding elements, right?
      'abc'∘.,'1234'  ⍝ manually added \\s to indicate diagonal
\a1\ a2  a3  a4
 b1 \b2\ b3  b4
 c1  c2 \c3\ c4
 
ah yes
 
1:19 PM
And the diagonal stops short when one axis ends.
The interpreter could (but doesn't currently) optimise away the unnecessary computations in 1 1⍉∘.>
 
⌊⍥≢↑⍉⍤↑⍤,⍥⊂ does seem a bit... verbose, having come from Python where that's just zip()
 
Sure, but that's because it includes a "parameter" to cut short by shortest. How do you, in Python, do a zip that pads with 0s?
 
Yes, ↑⍤,⍥⊂ does beat from itertools import zip_longest; zip_longest(x, y, fillvalue=0) :)
 
Further, it is because of taking the arguments as left and right. More natural, and better matching Python, would be to take a vector of vectors, in which case we have (⌊/≢¨v)↑⍉↑v or the more efficient ⍉↑v↑¨⍨⌊/≢¨v
 
That is true. It is nice how you can see exactly what the code does, without having to consult the docs.
 
1:27 PM
Right, there's nothing about the name zip that tells you what exactly it'll do in the edge cases.
@rabbitgrowth Now extend that to set the fillvalue to whatever is appropriate for the given arg.
Oh, and even ↑⍤,⍥⊂ isn't really fair. If you have a list of lists, it is just
 
@Adám :)
I do wish ,⍥⊂ were a primitive sometimes, like in BQN
 
yup, sometimes me too
but it is more flexible to have all the options like ,∘⊂ and (soon) ⊂⍛,
 
After all, it's such a fundamental operation that the other way to do it is just " "
 
and for higher rank, with being Promote: ⍪⍥∧ and ⍪∘∧ and ∧⍛⍪
 
Really looking forward to !
 
1:34 PM
me too
 
Is there still implementation work going on, or is it already pretty much done and just waiting to be released?
 
Which are you asking about 19.0, or ?
 
That's implemented, but I suspect there are some optimisations that need doing, and the inverting code probably doesn't handle it yet.
Also, back to the quest... turns out one can use !
 
is with array operands a thing? vaguely remember you once said those could be used to bind a default argument, but can't remember if it was something that's planned or just an idea
 
1:39 PM
≢¨0 1⌸? :)
 
@RubenVerg Just an idea.
@rabbitgrowth Yes!
 
:)
 
@Adám ah, ):
 
@RubenVerg How would that be different from ?
 
I'm looking through competition submissions… Someone wrote {m ← ⍺⌊⍥≢⍵ ⋄ ¯1+{≢⍵}⌸0 1,>⌿m↑⍤1↑⍺ ⍵}
@rabbitgrowth 1 (2⍛f) 3 gives 1 f 3 while (2⍛f) 3 gives 2 f 3.
 
1:43 PM
I see
 
@RubenVerg Indeed, someone submitted (≤,⍥(+/)>){⍺(⍵⍵⍨ ⍺⍺ ⍵⍵)⍵}(⌊⍥≢⍴⊢)
 
Has anyone managed to get apl-form = 'enable' to work when compiling Iosevka font? github.com/be5invis/Iosevka/blob/main/doc/custom-build.md
 
People had lots of fun ideas. Bet most never used a fork in an outer product: ∊1 1+/⍤⍉∘.(≤,>)
 
∘.≤,¨∘.> is more efficient, right?
 
Well, yes, I guess, but the whole thing goes nested, so ¯\_(⍨)_/¯
 
1:50 PM
Wait, doesn't ∘.(≤,>) give the same nested result?
 
Coming back to my effort, how to continue from:
((⌊⍥≢)↑⊢) ≤ ((⌊⍥≢)↑⊣))
This looks so much too verbose.
how can this be shortened
 
@rabbitgrowth Yes, my point: Never mind efficiency when you're already not efficient.
 
ah, I see :)
 
@Richard Other than removing the unnecessary parens, there's not much, without majorly changing the structure.
 
ok, and for
( (+/,+/∘~)
 
1:53 PM
You could do ⊢,⍥(+/)~ but there are other ways.
 
It would be nice if there is some way to store an intermediate result and using it later. And then, without using arguments or variables. A function which temporaly stores the value. Maybe a stack.
 
That's what variables are for, though :-)
 
yes, but not in tacit style
 
If you reach that point, then maybe tacit isn't a good idea for the problem.
 
:)
 
1:56 PM
Anyway, feel free to continue development and discussion here. I have to go to another meeting (for the APL Challenge…)
See you next week for 2023-6: Key/Value Pairs!
 
(p)↑⊢) ≤ ((P⌊⍥≢)↑⊣))
Where P is push and p is pull
@Adám thanks!
 
@Richard (P↑⊢) ≤ ((P←⌊⍥≢)↑⊣)) sort-of works.
… gives the right result, but computes the value of P twice, and leaves a lingering P around.
 
@Adám that was me!
 
lol
 
2:52 PM
@Richard might be part of uiua's attraction then - tacit + stack !
@rabbitgrowth Could you explain this one? Don't see how this is supposed to work
 
 
2 hours later…
4:32 PM
@Silas ┏ for put on stack; ┗ pull from stack; ┓push on end/bottom of the stack; ┛ pull from end/bottom of stack. Only the horizontal line of the hook sybol should be longer to symbolise the queu/stack.
but I am not a programmer so not sure about the use of it. But as you mentioned, there is another language using it.
┏ ┓ (as one character); fill complete stack with vector or whatever
┗┛ pull complete stack
@Adám (┗↑⊢) ≤ ((┏⌊⍥≢)↑⊣))
;)
 
 
3 hours later…
8:01 PM
∇jx←{⎕IO←0 ⋄ ⍵[i]×1-⍨⊖i←3|-∘.+⍨⍳3}
     ∇
      ⍝ what is ⍵[i] here?
      i
1 0 2
0 2 1
2 1 0
      ⍝ How can you use i to index ⍵?
      ⍝ ⍵ is a array like v ← 1 2 3
{⎕IO←0 ⋄ ⍵[i]×1-⍨⊖i←3|-∘.+⍨⍳3} is 3x3 skew matrix from a 3-elem vector
skew←{⎕IO←0 ⋄ ⍵[i]×1-⍨⊖i←3|-∘.+⍨⍳3}
      u1 ← 1 2 3
      skew u1
 0 ¯3  2
 3  0 ¯1
¯2  1  0
 
8:17 PM
 u ← 0 1 0
      ⍴u 1 ⍴ u
DOMAIN ERROR
why I get domain error?
want to convert vector to 3x1 matrix
(⍴u) 1 ⍴ ⍕u
DOMAIN ERROR
      (⍴u)1⍴⍕u
still does not work
 
 
2 hours later…
10:21 PM
use u⍴⍨1,⍨⍴u
Or just ⍪0 1 0
 

« first day (2564 days earlier)      last day (85 days later) »