« first day (1142 days earlier)      last day (1515 days later) » 

8:20 AM
21 hours ago, by Jeff Zeitlin
@Bubbler - I had originally tried an approach using ⊤ but I wasn't getting the correct answers, and thought I'd been misunderstanding how ⊥ and ⊤ work. Can you provide any insights?
@Adám If you don't have a specific topic to touch for today's lesson, probably it's worth it to have an in-depth session on ⊥⊤, from what a "mixed base" is, how it is used along the two functions, to some sophisticated use cases and tricks like boolean ⊥⍨ and such.
... probably the most advanced usage being this one.
 
@Bubbler Nice. I'll do that unless another compelling subject is suggested. Thanks!
 
(And I actually forgot why a fractional left arg for doesn't give me the expected answers, like 0 2.5 2 5⊤⍵ for splitting coins into quarter/dime/nickel/pennies.)
 
 
1 hour later…
9:59 AM
@arcfide thanks a lot. I'll try and read the parser combinators code in Co-dfns and attempt to grok it!
@Adám are the lessons still ongoing?
 
10:12 AM
oh hi @arcfide, i've read some of your hn comments about having used ed, do you also use ed for writing apl?
 
10:23 AM
👋 hi everyone
 
10:45 AM
@SiddharthBhat They are. In fact, next one is in just 4 hours.
@KennedyAbitbol Hello, and welcome. Interested in APL?
 
@Adám it sounds very interesting, seems very cryptic
 
@KennedyAbitbol How do you feel about traditional mathematics?
 
@Adám not good, that's why
 
Yeah, that'd explain it. In many ways, APL is intended as a better mathematical notation than the traditional one — more than being a programming language in the classical sense (despite its name).
 
@Adám i see the large spectrum of application in advanced domains, sounds really great
 
10:55 AM
@KennedyAbitbol Yeah, and actually, if you dislike TMN (Traditional Mathematical Notation), you might actually like APL better, as it doesn't have all the inconsistencies and arbitrary limitations of TMN. Of course, the world can't function without mathematics, but at least we can make the notation smooth, and leave the heavy lifting to the computer rather than the programmer.
 
@SiddharthBhat there are also BAA (British APL Association) conferences which you can watch through a zoom link I believe. britishaplassociation.org
 
@TomCockram Nice. I didn't know that it had been made a recurring event. Btw, I think @SiddharthBhat wants to present, not just watch. Dyalog also live streams some presentation videos, and publishes the rest later.
 
@Adám I believe they try and do one meet up a month but not sure if there's always a zoom link to accompany it. @SiddharthBhat I would recommend this page dyalog.tv/Webinar/?v=6SAsgEvUmkU if you click 'Dyalog 19' or any of the years you can see the talks given at Dyalog's yearly conference. Very interesting videos on there.
 
@TomCockram Oh, I know about their monthly meetings, where I participate occasionally. However, they happen in a pub with little to no connectivity.
 
@Adám oh I see yeah, I believe Jake says he tries to setup the zoom meeting, so if he is there most likely a stream.
 
11:10 AM
@Adám - I'm doing a bit of cleanup and rearrangement on this computer, including making sure I have a good suite of browsers. Is the tally bug a Chrome-browser problem, or a Chromium-engine problem? IOW, am I going to see it in Chromium Edge and/or Vivaldi?
 
@JeffZeitlin You'll see it in any Chromium-based HTML renderer. It isn't really a bug, but rather a consciously made configuration parameter for HarfBuzz, the text shaping engine everyone (including Firefox) uses.
Maybe I should write up an APL Wiki page on the "bug".
@JeffZeitlin Btw, you can "fix" the "bug" by making sure the character is rendered in a font that includes it. The easiest is to set your browser's default serif, sans-serif, and monospace fonts. This won't fix everything, but you can inject CSS to override sites, and fix it universally.
 
@Adám - Any recommendations for serif and sans? Mono would obviously be APL385 Unicode
@Adám - BTW, what turned out to be the bot's problem? I see you've gotten it back on-line...
 
@JeffZeitlin The bot isn't here.
@JeffZeitlin DejaVu Sans and DejaVu Sans Mono are nice. Maybe Cambria for serif?
 
@Adám - That "Dyalog APL" isn't the bot?
 
@JeffZeitlin No, that's just the bot's SE account.
 
11:24 AM
@Adám - Oh, OK
OK, I've set Serif as DejaVu Serif, Sans as DejaVu Sans, and Mono as APL385 Unicode. I'd had Georgia Pro, Verdana Pro, and Noto Sans Mono before.
So, if I insert ≢ without backticks, and with backticks, I should see the Sans and Mono renderings...
... And it's still a problem on Chrome.
So, either SE is overriding my font choices, or Something Else is going on.
... And if I open up the development console in Chrome, I see that SE is in fact overriding the browser font choices.
 
@JeffZeitlin You can use the Stylus extension to override that.
 
@Adám - I have to go rummaging my various notes to figure out how to override the block on adding extensions to Chrome here.
 
11:39 AM
 
12:01 PM
OK, got it installed. Now just need docs for it...
 
12:11 PM
Testing unbackticked ≢ and backticked again...
OK, got a temporary fix. Basically just edited the downloaded CSS.
 
12:25 PM
@JeffZeitlin {S} > [Manage] > [Write new style] > give it a name, and add the content pre,code{font-family:"DejaVu Sans Mono"} then click [Save?]
This won't fix the "unbackticked" ≢s but that really shouldn't happen for APL code anyway.
 
Got it, modulo using APL385 Unicode instead of DejaVu Sans Mono. Thanks
(Of course, I could just use Firefox for the Orchard...)
 
12:55 PM
@mappo This has now been fixed. Thanks!
 
1:08 PM
@Adám - Actually, a little experimentation indicates that one also needs a line div.message code {font-family: "APL385 Unicode"}; it seems that that level of specificity is specified in the site CSS, so overrides a mere code.
And by specifying body{font-family:"DejaVu Sans"} handles it for the unbackticked.
I take it that the difference comes down to which fonts have the glyph defined explicitly/directly as opposed to being a composition of and /?
 
@JeffZeitlin Even if the font doesn't have the glyph, Unicode defines it as a composition. HarfBuzz is told to render the glyph using a specific font. If the font doesn't have the glyph, it can go look for a different font or try to compose the glyph. Firefox configures HarfBuzz to opt for a different font before resorting to composition, while Chromium asks HarfBuzz to prefer composing over substituting fonts.
 
1:26 PM
@Adám - Ah. I think FireFox's choice makes more sense.
It's also consistent with what Office, for example, does.
 
@JeffZeitlin Both make sense. Chromium's choice gives a more consistent "look" at the cost of fidelity.
 
@Adám - I don't know if FireFox does it, but it seems to me that by picking a font that has a "close" Panose number, you can have the best of both worlds. Especially if composing doesn't work properly, as seems to be the case with Chrome.
Of course, that does start the debate over "What's a "close" Panose number"...
 
2:03 PM
What time does today's Cultivation start?
 
2:24 PM
@JeffZeitlin In 5 mins.
 
@Adám - OK; I was thinking 9:30 my time - but I forgot that we're now on what you call Summer Time «flippin' st00pid idea, that».
 
Time zones in general have outlived their usefulness. It is time for everyone to simply move to UTC, imho.
 
@Adám - Well... Yes and no. There are, apparently, sound psychological reasons for having a daily rhythm that more-or-less coincides with local daylight.
 
@JeffZeitlin Oh, I didn't mean to change any behaviour at all, just introduce universal labelling of moments in time.
 
@Adám - OK, I could accept that. It doesn't really matter to me whether my day starts at sunrise at 0600, or sunrise at 1000.
 
2:30 PM
Stores should still open a few hours after people get up and close mid-afternoon. But some places would call that 04:00.
Time for APL Cultivation
 
Sounds like a good excuse to just go to Extended Swatch Internet Time...
 
That is, if anyone's around for it.
 
/me raises his hand
I like @Bubbler 's idea of ⊥ and ⊤
 
Sure, we can do that.
Then let's begin with a basic understand of what a number system really means.
When we write 123…
It really means +/1 2 3×100 10 1
But why 100 10 1?
 
Because we have ten fingers, ultimately :)
 
2:34 PM
So you might say that's 10*2 1 0
But another way to look at it is ⌽×\1,2⍴10
The 1 here is the "seed" or initial value for our running product.
And now we can see a way to generalise this.
Instead of 2⍴10 we could choose two different numbers.
E.g. 60 and 24
This gives us ⌽×\1 60 24 or 1440 60 1
This would be a days-hours-minutes system, 1 day being 1440 minutes.
So if we have 1 day, 2 hours, 3 minutes, how many minutes do we have?
      +/1 2 3×1440 60 1
1563
This brings us to what does. It takes a mixed-radix spec as left argument, and evaluates how many of the smallest unit a given "number" (expressed as a vector of "digits") corresponds to.
      0 24 60⊥1 2 3
1563
Now, notice the difference in the spec between the +/× method and the method.
We don't have to specify the unit (which'll always be 1 anyway) on the little end, but instead, we pad with a 0 on the big end. The 0 is ignored, and could actually be any value.
 
If it's ignored, why is it needed in the first place?
 
In order to match the length of the right argument.
 
Now, APL of course allows using a scalar and will distribute it to all positions. This allows things like:
      10⊥1 2 3  ⍝ "base ten"
123
      2⊥1 0 1   ⍝ "binary"
5
So is really a kind of fanciful cover for +/× or actually +.×, the latter explaining why takes a transposed argument.
 
2:50 PM
Although if you use +.× you have to actually multiply things out - 10⊥1 2 3 is 100 10 1 +.× 1 2 3
 
Yes, exactly.
      10 10 10 ⊥ ⍉2 3⍴1 2 3  3 2 1
123 321
      100 10 1+.×⍉2 3⍴1 2 3  3 2 1
123 321
We can model as:
      1 10 10 {(⌽×\⍺)+.×⍵} ⍉2 3⍴1 2 3  3 2 1
123 321
      1 60 24 {(⌽×\⍺)+.×⍵} 1 2 3
1563
Like that.
Because has a specific definition rather than being some specialised type-dependent utility, it can be used for some unusual tricks that have little apparent connection to base-conversion.
One that has achieved some fame is ⊥⍨ on a Boolean vector. Let's analyse what it does.
 
This is a monadic use of ⊥⍨?
 
So, let's say we have the vector 1 0 1 1 1.
@JeffZeitlin Yes. The dyadic form would just have its arguments swapped.
 
/me nods
 
will cause the vector to be used both a base specification and as the count for each "type" place ("hundreds", "tens", ones).
So we have 1 0 1 1 1⊥1 0 1 1 1
Remember, this really means +/(×\⌽1 0 1 1 1)×1 0 1 1 1
 
3:04 PM
But the implicit ×\ is going to hit that zero, and everything else will be zeroed out.
 
Exactly. Btw, for Booleans, ×\ and ∧\ mean the same
 
So we'll get 1 1 1 0 0, and then +/ gives us ... 3
 
Yes! That's why ⊥⍨ is "count trailing 1s".
Because conceptually, we add 1s from the right (though each is multiplied by increasing powers of 1 — all 1*n being always 1 of course), until a 0 causes everything after that to become 0 (n×0 being always 0 of course). Finally, we sum.
OK, another trick, often used in tacit APL is 1⊥something. Let's analyse that one.
 
Well, if something is a boolean vector, it's gonna count 1s
 
@JeffZeitlin True, but it can do more.
The first thing we can recognise here is that the 1 will be expanded to match the length of the right argument, so say 1⊥3 1 4 really means 1 1 1⊥3 1 4
So again, this is +/(×\⌽1 1 1)×3 1 4
 
3:09 PM
Wait...
 
Yes?
 
But ×\ is going to give me a vector of 1s, which is still "1". That's the multiplicative identity, which means that 1⊥ is equivalent to +/
 
@JeffZeitlin Well done! Yes, pretty much. But remember the transposing when dealing with multi-dimensional arguments, and you'll soon realise that it is +⌿
OK, another trick, sometimes used in tacit APL is 0⊥something. Let's analyse that one.
@JeffZeitlin Want to have a go?
 
Wait, I'm still not following the "transpose".
 
No problem. Let's look at that.
Notice that the two numbers 271 and 314 are represented in base 10 as:
      ⍉2 3⍴2 7 1  3 1 4
2 3
7 1
1 4
Why? Because then we can do:
      100 10 1+.×⍉2 3⍴2 7 1  3 1 4
271 314
Same thing as:
      +⌿100 10 1×⍤0 1⍉2 3⍴2 7 1  3 1 4
271 314
Or in other words, we multiply each row by its place weight (big endian) and then sum vertically.
Clearly then, if the weight is a constant 1, we have a simple vertical summation, or +⌿
@JeffZeitlin Clear?
 
3:20 PM
OK, I think so.
 
Now, do you want to try to find out what 0⊥something does?
 
Well, that's +/(×\⌽0...)×something, where 0... is a vector of zeros whose length matches ⍴something, right?
 
@JeffZeitlin Almost. Remember that the vector is the weights, not the bases (though for 1 it doesn't matter).
E.g. 10 10 10 corresponds to 100 10 1
How do we go from 10 10 10 to 100 10 1?
 
*2 1 0
 
@JeffZeitlin No. Consider 0 24 60 which became 1440 60 1
 
3:29 PM
Right, it did.
 
So?
 
Drop the zero, reverse, prepend 1, multiply-scan, reverse again. ⌽x\1,⌽1↓
 
@JeffZeitlin Good. What does that give us for our all-zero base?
 
Ah. The last entry is still a 1.
 
Exactly, so what does 0⊥something do?
 
3:35 PM
I'm still missing something, because experimentally, it counts the number of digits you passed it on the right - but I'm not quite seeing how it gets there.
 
@JeffZeitlin Try a different more random argument or try reasoning about it.
 
OK. First, the left argument is extended to match the shape of the right argument. 0⊥314 is the same as 0 0 0 ⊥ 3 1 4
 
Right so far.
 
But now, we apply that train to the vector of zeros. ⌽×\1,⌽1↓0 0 0 gives us 0 0 1
 
Good, good. Keep going.
 
3:39 PM
0 0 1 × 3 1 4 is 0 0 4
 
Right. Now what?
 
0
Q: Finding characters in Classic Dyalog APL character set

August KarlstromIn Dyalog APL the character vector ⎕AV contains all characters in the Classic Dyalog APL character set. Where can i find information about what each character in ⎕AV stand for? I'm trying to find out what each control character in the ASCII encoding corresponds to in ⎕AV in order to filter out in...

 
and +/ 0 0 4 is 4
 
Correct. So can you summarise what 0⊥something does?
 
So, it looks like my confusion was due to using ⍳k as an argument, and what 0⊥ really does is give me the last digit.
 
3:42 PM
@JeffZeitlin Right, that's what I figured. Can you come up with an alternate form for 0⊥ just like we had +⌿ for 1⊥?
 
That's a golf stroke! It's ¯1↑
 
@JeffZeitlin Not quite. Try analysing the result with and/or .
 
Well, if I give it a matrix (e.g., 2 5 ⍴ 9 1 4 7 3 8 3 9 8 1), it still looks like it's giving me ¯1↑ - I get 8 3 9 8 1 both ways.
So something about ≡ must be key.
 
      ⍴⎕←0⊥2 5 ⍴ 9 1 4 7 3 8 3 9 8 1
8 3 9 8 1
5
      ⍴⎕←¯1↑2 5 ⍴ 9 1 4 7 3 8 3 9 8 1
8 3 9 8 1
1 5
 
oHO!
 
3:49 PM
@JeffZeitlin So? Dare to state an equivalent?
 
Damn. I remember there's a way to do that, but I'm blocking on it.
DOH!
,¯1↑
 
Nope, try it on a vector.
 
But on a vector, it just gives me the last item.
 
@JeffZeitlin Check the shape, or try it on a 3D array.
Or even better, try reasoning about it!
 
⍴¯1↑ is going to be 1, and ⍴,¯1↑ is also 1
 
3:54 PM
But what is the shape of 0⊥3 1 4?
Anyway, you should be able to reason your way.
Remember that the last two steps were 0 0 1×3 1 4 and then +⌿ on that?
 
Wait. That gives me a scalar on a vector right argument. And a vector on a 2D right argument.
So it's dropping one dimension.
 
Hint: a long-winded way would be to remove the leading 1 from the shape (by using as both "shape" and "reshape"), but there's a shortcut in the form of (something)⌿.
 
Indeed, as +⌿ reduces the number of dimensions.
^^
Time's up!
 
I'm not seeing it.
 
Since we're returning the last major cell unmodified, it is the same as ⊢⌿.
 
4:03 PM
?
Oh!
 
0⊥3 1 4 is the same as 3⊢1⊢4 and similarly along each of the columns of a matrix.
 
Quick explanation: ⊢⌿ a b c -> a ⊢ b ⊢ c -> a ⊢ c -> c :)
 
Got it!
 
I thought and would have too little material for a whole lesson, but we only covered . Wow.
That's all folks!
 
Wow! That's intense.
 
4:05 PM
:-D
 
And I think I was ... not far... from the solution; I kept hovering around "No, it's NOT =⌿ - but it's something like".
I couldn't make that last leap to ⊢
 
Don't worry about it. Somehow and seem to be tricky to grok despite being the simplest of all functions.
I guess next lesson's subject is determined then.
 
/me nods.
Honestly, though, I'm sorta thinking that my previous exposure to APL\360 - which didn't have ⊢ and ⊣ that I recall - is interfering with picking up on some of the more recent innovations.
A "mental groove" that I've got to break out of.
(like still thinking in terms of tradfns instead of dfns)
 
@JeffZeitlin Check out APL Wiki's Learning resources for old APLers.
 
Will definitely look at that.
 
 
1 hour later…
5:32 PM
@dzaima and another one caught while working on the TNB CMC (working mostly on micro-optimizing the horrible O(n^3) solution, down to ~5s for 9)
while at it, noticed is making a regular double array, not a packed bit array. ಠ_ಠ
 
@dzaima Oh, you've implemented packed bit booleans?
 
@Adám have for a long while. but apparently haven't used them in places they should be
(and they're often awfully slow, and many things don't know about them and just cast them to double arrays (e.g. 1 0 1×1 1 0 is a double array))
 
5:56 PM
So it looks like one of the reasons that I was having problems when I tried to do the Make Change CGCC challenge was because I wasn't realizing that ⊥ is effectively doing a ×\ on the left argument. I'd somehow gotten it into my head that it was a 'straight up' position value, e.g., 25 10 5 1 was "twenty fives", "tens", "fives", "ones" rather than ⌽×\1 5 10 25 (which works out to 1250 50 5 1).
If I wanted to attack it that way, I'd need to use 0 2.5 2 5 - but I have a sneaking suspicion that that non-integer would be a nasty problem in some way.
 
6:15 PM
@JeffZeitlin That works fine:
      0 2.5 2 5⊥1 2 0 0 ⍝ a quarter with two dimes
45
 
Hmmm... Oh, that's right - NEXT cultivation. It was ⊤ that I wanted, to convert 143 to 5 1 1 3 (quarters, dimes, nickels, pennies)
 
6:48 PM
Looking at the NARS2000 documentation, my APL solution to the Dottie problem would in fact be valid (with one slight modification) if the interpreter were NARS2000, since I can set ⎕FPC to whatever I want, and then 2○⍣=1v (the modification is to add the 'v') does the calculation to the arbitrary precision defined in ⎕FPC.
(It's really too bad that NARS2000 is locked to Windows and the GUI; having it as an APL option on TIO would be nice...)
 
 
2 hours later…
8:51 PM
@JeffZeitlin you'd also need to set ⎕CT, otherwise = stops the calculation at 15 digits of precision
 
9:42 PM
@dzaima a bunch of random (and most, pointless) optimizations, under 1s!
 

« first day (1142 days earlier)      last day (1515 days later) »