« first day (1251 days earlier)      last day (1403 days later) » 
00:00 - 20:0020:00 - 00:00

12:26 AM
@dzaima I think I'd prefer the naught (⍬) behavior more often, but would go with the backward (←) behavior personally, assuming it's a primitive you want to add to a dialect. Only because I think it's easier to extend from ← to ⍬ than from ⍬ to ←. @all Is that a reasonable enough reason to implement something ceteris paribus?
AKA something like {⍺<⍵: ⍬ ⋄ primitive} vs. {⍺<⍵: ⌽primitive ⋄ primitive}
I think the first is clearer
 
@AviF.S. imo the first would have to be {⍵=⍺+1:⍬ ⋄ ⍺<⍵:error ⋄ primitive}
 
@dzaima Well that would definitely change things...
Well whichever is easier to convert to the other, is my suggestion!
As reading that isn't perfectly clear to me...
 
@AviF.S. and even in that case, i think both impls are similar enough in complexity for it to be an insignificant matter
 
@dzaima Agreed! If they're similar enough then it doesn't matter. But I find the first one significantly clearer somehow
In a case like this it seems better to overextend and let the user de-extend, than under extend and force them to craft an extension. I suppose that's what I was trying to say
So conceptually and efficiently-wise, they're equal. But on a more fundamental level, the first one seems better to me somehow. I may very well be wrong here, but that's my two cents
 
 
1 hour later…
1:44 AM
When there can be multiple conflicting extensions to a primitive, keeping it simple (i.e. not extended) is also an option.
 
Holy moly!!! Same exact time... I was just about to paste in a CMQ I wrote. I suppose you'll get a heard start, @Bubbler :)
Was reading it over & hovering over 'send' when you sent that, so I deleted it to express my astonishment ⍥
@Bubbler Agreed, but that seems more the case when it's actually complicated
Alright, here goes:
CMQ: You have a grid of lights arranged on/off in a checkerboard pattern. It's an n by n square grid where n is odd. And n is the right operand, ⍵. There's a light switch connected to each lamp in the grid. The left operand, ⍺, is the number of times you should flip the light switch. Print the final state after ⍺ flips.
---
Note: You may start with the grid in either of the two possible states below. But whatever is given by 0 {...} *n* must remain consistent throughout as the starting state.
⌺⎕⌺        ⌺⎕⌺
⎕⌺⎕        ⎕⌺⎕
⌺⎕⌺        ⌺⎕⌺
 
and are arguments, not operands.
 
@Bubbler Whoops, thanks for the correction!
I know, I know. Missed a perfect opportunity to use lamp ⍝, but what would be the off equivalent?
 
Also, think I'll add it as CGCC, or whatever the acronym is, question. Though, I'll probably remove the constraint that n must be odd. I won't for the APL challenge because there's a nice solution which doesn't work in that case. Feel free to answer for the more general question where n can be any integer, and please note if it also works for evens!
The other variant that I recommend solving/competing for is the specific case where n = 3. Likely an easier starting point, and would be interesting to see alternatives to that if there are some which don't generalize trivially to an odd n.
 
If I flip a switch once, do I change state of all the lamps or just one?
@AviF.S. The two states you presented are identical...
 
1:51 AM
@Bubbler That's too funny!!!
@Bubbler Thanks for the correction
   ⌺⎕⌺    ⎕⌺⎕
   ⎕⌺⎕    ⌺⎕⌺
   ⌺⎕⌺    ⎕⌺⎕
 
Are you thinking of this: {⍵ ⍵⍴⍺|0 1}?
 
^ is a cleaner version of the lamp arrangement
 
One that works for both odd and even : {2|⍺++/¨⍳⍵ ⍵}
 
@Bubbler Not quite. They should all switch every time. So it should go from the first state shown, to the second, back to the first, and back to the second
 
Oh wait, I meant {⍵ ⍵⍴⍺⌽0 1}
What a funny mistake.
 
1:59 AM
@Bubbler Shoot! I'd no idea it was that easy!! You've completely outdone me, too :(
I was so happy, haha!
I had: {2|⍺+⍵ ⍵⍴⍳2}
@Bubbler Wow. You have me beat clean!
Well, it should be really interesting to see implementations of this in all sorts of esolangs, methinks!
@Marshall @all You missed the fun...
Don't look at the end; there's spoilers. @Bubbler beat me in half a minute at my own game
RE asking as code golf challenge: This difficulty, or even far more trivial, tends to be the level of question I like to see there because it encourages all the ridiculous esolangs and tarpits to come out from the corners where they were hiding. Otherwise no one bothers writing solutions in some of the really other-worldly languages if it gets any trickier than this! Seem worth writing up the Sandbox post?
 
@AviF.S. No, you all missed me cutting three whole lines from parenthesis processing.
 
@AviF.S. Go ahead.
 
@Marshall So we were the ones missing out! In Soviet Russia, out misses you ( ͡° ͜ʖ ͡°)
@Bubbler Any chance that's further golfable? (That doesn't sound right; conjugated properly?) AKA is it worth leaving the generalized CMQ up for battle?
 
@AviF.S. {2|⍺+∘.+⍨⍳⍵} has the same length as this one. BQN's version {2|𝕨++⌜˜↕𝕩} is one character shorter (matching Bubbler's) because of the single-character Outer Product .
 
As I'm pretty sure the first can't be beat
@Marshall Hmm.. Can BQN do better on the general version?
 
2:15 AM
@AviF.S. Well, you can do {𝕩‿𝕩⥊𝕨⌽↕2} since it has index origin 0, but that's probably the best.
 
Same length alternative (general): {~⍣⍺∘.=⍨2|⍳⍵}
 
@Marshall @Bubbler I was just thinking you could shave off another byte, leaving me further in the dust, with {⍵ ⍵⍴⍺⌽⍳2} & ⎕IO←0 in the header
@Marshall But for the general version. That's just a port of the odd-specific one
@Marshall Or was this section for the general one?
 
@AviF.S. That one was general.
 
@Bubbler I've a lot to learn!
@Marshall I see. Thanks for clarifying
Well so much for that problem!
 
@AviF.S. 2|+⌜⍟2˜⟜↕
 
2:26 AM
Related question: To get a simple boolean matrix from stencil, is the best way to first enclose and then 'first' each?
Eg. ⊃¨({⊂=/⍵}⌺1 2)
To check if adjacent elements in a matrix are equal
 
@Marshall Which I guess translates to 2|∘.+⍣2⍨∘⍳ in APL if you really like adding characters.
 
@Marshall Neat! Will take a sec to parse
@Marshall Quite helpful; thanks!
 
@AviF.S. I think you just want {=/,⍵}⌺1 2. Your problem is that the argument is a matrix so =/ gives you a vector instead of a scalar.
 
@Marshall Interesting, thanks!
Does that mean if you could use the missing depths operator ⍥ (or however one would do that) to +/ the insides of 3 1⍴⍳3 you'd get ⊂,6?
 
@AviF.S. No, f/3 1⍴⍳3 has shape 3 regardless of what f is: reduction always removes the reduced axis from the shape and leaves the rest. 3 1⍴⍳3 is a flat array so it doesn't have much for insides either.
 
2:41 AM
@Marshall On the first part: I know that it won't work but I was conceptually thinking about summing the insides. Maybe that's a silly way to think. On the second part: I think I totally screwed up. I believe I was thinking of ⊂⍳3
@Marshall Does that make any more sense?
 
@AviF.S. Well, +/¨⊂⍳3 is ⊂6, which is close, but it's not all that interesting. It just says Each works inside of an enclose.
 
Hmm, I suppose I'm way off. I was attempting to think of another case where one could demonstrate that same phenomenon re: 'the argument is a matrix so =/ gives you a vector instead of a scalar.'
 
3:15 AM
@AviF.S. I think Marshall wanted to say this: in f⌺x, f is called several times with a matrix argument. If f gives simple scalar, the entire result of f⌺x becomes a simple matrix; otherwise the result becomes nested.
 
@Bubbler Thanks for the clarification! As it happens, I did understand that. However my go at replicating that behavior in an instance where it would be easier to see was not fruitful
 
A close thing is probably a non-scalar reduction such as ,/, which encloses the result of reduction in order to keep the invariant "the result of f/ has the last axis removed".
 
@Bubbler Not quite. mixes its result, so you won't get any extra nesting unless the operand adds it.
 
3:31 AM
Oh, I was wrong then
Anyway, making f in f⌺x always return a simple scalar is a good way to keep things simple
 
4:18 AM
@AviF.S.
@RGS S‽
 
@Adám Haha, true... ⍝∩ Although, side by side they're not looking so great
I still think the syntax highlighting makes this otherworldly, though: dzaima.github.io/paste/…
 
@AviF.S. Font issue.
 
@Bubbler Yes, thanks. Very good to know
@Adám Opposite issue in APL385/6, though. The ⍝ becomes too big...
 
@AviF.S. ∘○ or ∘⍟ is pretty too
 
4:29 AM
@AviF.S. yeah. I never noticed before.
 
Shoot. I screwed that up...
 
are you doing these by hand?
 
@Adám No, no!
The code is ugly enough that it's not worth sharing, but no
@Adám It'd be cleaner if I knew how to do 'abc'[1 2 3] where 'abc' is a matrix. How is that done?
 
      (2 2⍴⎕A)[3 1⍴(2 2)(1 2)(2 1)]
D
B
C
But why?
 
@Adám To index the boolean array with '∘○'
 
4:37 AM
@AviF.S. Uh, '∘○' is a vector.
 
And clean up the code, which I did with ↑{sub[1+⍵]}¨↓boolmat
@Adám Shoot! Sorry about that
I meant where 1 2 3 is a matrix...
 
@AviF.S. '∘○'[boolmat]
 
@Bubbler Thanks, I messed it up in communication!
 
      '○∘ '[2(|,2,⍣3~⍤|)∘.+⍨⍳3]
○∘○   ∘○∘
∘○∘   ○∘○
○∘○   ∘○∘
 
@Adám Doesn't work on this end
Index Error, I get
 
4:39 AM
⎕IO←0
 
Haha, thanks
@Adám Is that your default? Or just here with bools for ease?
 
Originally here for easy, but '○∘ '[2(1+|,2,⍣3~⍤|)∘.+⍨⍳3] works too.
 
@Adám Definitely infinitely clearer than what I had before...
@Adám @Bubbler It's tiring to be beaten so often, haha
 
Another one with ⎕IO←0: '○∘ '[(⊢,2∘⌈,~)2|∘.+⍨⍳3]
 
@Bubbler Nice, but why 2∘⌈ and not just 2?
 
4:45 AM
@Adám Just wanted to keep three spaces.
 
Oh, of course. Too early in the morning.
2⍨¨ might be clearer and faster.
(I personally think should work.)
 
Could be. I just had Extended TIO tab open, so I naturally typed before fixing it into 2∘⌈.
Meanwhile, yet another ⎕IO←1 version: '○∘ '[(⊢,3--⍨,⊢)3 3⍴⍳2]
 
Cute. ⍳2
 
ninja'd
 
 
1 hour later…
6:00 AM
@RGS OK, both should be fixed now. Thanks!
 
 
1 hour later…
7:27 AM
what's a good glyph to use for explicit atop?
 
@dzaima Re: the setxkbmap issue we have both encountered, I've finally published a blog post on how I bypassed the issue: 5ab5traction5.bearblog.dev/apl-keyboard-keeper
 
@Moonchild Dyalog APL 18.0 uses . Do you want something different?
 
@Bubbler ah, no, I missed that
 
7:41 AM
@ab5tract Seems to be formatting issues in the paragraph beginning "<.graph> is a handy included character…"
 
RGS
8:12 AM
@Adám +← 1
 
@Adám Thanks @Adám! I've fixed this and a few other issues (in fine ab5tract tradition, after-published editing was deemed necessary :) )
I'm curious how the Raku reads to those who don't know the language, if anyone has any thoughts on it.
 
@ab5tract Not that bad, actually. The header syntax is a bit cryptic to me, but other than that, it is pretty readable.
@ab5tract Can you find a way to reference your blog post here?
 
8:28 AM
@Adám Great idea!
@Adám Sorry, what do you mean by header syntax here?
 
@ab5tract :$interval = 30, :$key = 'caps_switch', :v($verbose) = False
 
I have a vector containing 9000 integer elements, where each group of 9 has 3 sub-groups that I'd like to separate out, resulting in a matrix with the shape 3 1000 3. Here's what I did:
⎕IO←0
m←(9÷⍨≢data) 9⍴data
a←m[;0 1 2]
b←m[;3 4 5]
c←m[;6 7 8]
d←↑a b c
 
Ah, gotcha, yeah. The signature syntax is kind of special, leveraging a lot of the builtin features. You've got inline default assignment going on here as well as Pair shorthand (:keyPair.new(k => 'key', v => True))
 
but there must be a better way, going straight from the source vector?
 
So :$foo ≡ foo => $foo
 
8:33 AM
@ab5tract OK, no wonder I was bewildered.
 
the use of :v($verbose) is more specific to the MAIN as it creates two named CLI flags to assign to a single variable. In a signature to a regular subroutine this just means you pass the value assigned to be assigned to $verbose to the named argument v.
@Adám :) ... it's definitely not a small language but a lot of that kind of stuff gets picked up by the brain pretty quick, similar I guess to APL idioms
The pair syntax I miss a whole lot whenever I have to go to another dynamic language that makes me do func( request => request, otherObviousNameForBothCalleeAndCaller => otherObviousNameForBothCalleeAndCaller)
Anyway, thanks for reading!
 
@xpqz 1 0 2⍉(9÷⍨≢data)3 3⍴data
WIBNI 1 0 2⍉¯2 3 3⍴data worked…
 
8:50 AM
@Adám Well I never... there's a dyadic ⍉?
(clearly)
 
Yes, in fact monadic is just dyadic with a default left argument (⌽⍳≢⍴⍵). I occasionally claim that one has not mastered array programming until one has mastered dyadic .
 
I am very far from mastery.
 
I'm slowly getting there.
 
:D
 
Dyadic should really be called "reorder axes". This is what we do here.
@xpqz Do you want to know how to find this solution?
 
8:53 AM
Yes please
 
So this is probably going to sound random... I've been searching for an APL paper by someone who was writing from a standpoint of having long sought a language which could convey and model systems of management. I don't think it is located in the J Papers archive, IIRC I found it by following a link on a bio page to the page of someone's mentor..
 
OK, so first I used ⍳90 as sample data. This allowed me to see that we're filling one row from each layer first, then the second row from each layer, etc.
 
(sorry, not to derail this lesson, which I will be engaging with!)
 
@ab5tract Maybe add?
… The normal way of filling is all rows of the first layer, then all the rows of the second layer, etc.
That is, we're still filling row-at-a-time, so the last axis is fine. We simply need to swap the filling of the first two axes.
So, while our final shape is 3 n 3 we temporarily need to make our array n 3 3.
Then we simply need to swap our axes back into place.
1 0 2⍉ says axis 0 should become axis 1 and axis 1 should become axis 0, and axis 2 should stay axis 2.
@xpqz Makes sense?
@akhmorn Welcome to. Interested in APL?
 
It does make a lot of sense. I figured there was a way, I just didn't have the skills quite to express it.
Thank you.
 
8:59 AM
Btw, I think this could become an excellent tutorial on array handing. May I use your material?
 
Of course!
 
@xpqz For great questions like this one, also consider posting them on SE so others have a chance to find them.
 
I'm realising that this is the key concept to really master.
 
Exactly. Dyadic is the symbol of array mastery.
 
0
Q: How do I convert a vector of triplets to a 3xnx3 matrix in Dyalog APL?

xpqzI have a vector containing 9000 integer elements, where each group of 9 has 3 sub-groups that I'd like to separate out, resulting in a matrix with the shape 3 1000 3. Here's what I did: ⎕IO←0 m←(9÷⍨≢data) 9⍴data a←m[;0 1 2] b←m[;3 4 5] c←m[;6 7 8] d←↑a b c which does what I want -- but can I sha...

 
9:15 AM
@Adám Do you mean add it as a request for the paper? Because my issue is that the I've lost track of it and have been unable to find it after digging in around. I'll expand the search to include all of the links on that page though, thank you!
 
@ab5tract Oh, I thought you had it, but didn't remember how you found it.
 
Unfortunately it's the failure mode in both, rather than just the one :(
 
2
Q: How do I convert a vector of triplets to a 3xnx3 matrix in Dyalog APL?

xpqzI have a vector containing 9000 integer elements, where each group of 9 has 3 sub-groups that I'd like to separate out, resulting in a matrix with the shape 3 1000 3. Here's what I did: ⎕IO←0 m←(9÷⍨≢data) 9⍴data a←m[;0 1 2] b←m[;3 4 5] c←m[;6 7 8] d←↑a b c which does what I want -- but can I sha...

 
@Adám mind if I hop on there and use your code in the answer?
Or are you preparing one already?
 
I was writing it up, but if you're happy to do it, go ahead. I have other things to attend to.
 
9:21 AM
Sounds good, glad to set your fingers free to other pursuits
 
You may want to use data←⍳45 as sample data rather than ⍳90
@ab5tract If I see potential improvements once you post it, do you want edits or comments?
 
@Adám Gladly
 
Oh, I meant to ask which :-)
 
lol. Comments are good, if it's not an imposition.
 
np
@ab5tract You are John Longwalker?
 
9:31 AM
yes. did I mess up with my edit?
 
No, I'm just inserting a proper reference.
 
Ah, good point, thank you
haven't done much wiki editing in my days, actually.
 
Yeah, there were some issues with the markup. Now you script has proper syntax colouring.
 
10:19 AM
@Adám I'm impressed with the highlighting. Is it Raku specific or does the Perl highlighter like my code well enough to fool?
 
@ab5tract lang="perl6"
 
That is quite cool! Not used to seeing support for it :D
 
@ab5tract Yeah, saw that. Why do you have empty lines after " lines"? (Also, I recommend ⎕← over for various reasons I can elaborate on if you're interested.)
 
That's probably because there was over-aggressive line expansion when I copy pasted from Jupyter
seems to happen a lot
But also I like the readability
adjusted to your comments
 
@ab5tract ⌷←⎕←
@ab5tract I think you're missing the part on how one finds this solution, i.e. by looking at the desired order of "filling" the array.
 
10:27 AM
yeah that's the part I'm loosest on
if you' like to edit to add that, I'd be glad
For me the best explanation was that it was slicing the 9 columns into 3 so your words will benefit me too
 
But it isn't at all obvious from the outset that the two 3s are to be combined.
@ab5tract I'll do some heavy-handed editing, and then you can roll back or adapt as you see fit. OK?
 
sounds great, hopefully i actually saved you some time in the end :/
 
This is part of my job. Even if you didn't, I might have achieved teaching multiple people something, instead of just one :-D
 
10:42 AM
@ab5tract Thanks!
 
Any time :)
 
@ab5tract Have a look.
 
@Adám And now I feel that I truly understand how you got there. My explanation relied on having the insight of the intermediate slices being each of shape n 3 but this explanation goes from the basis of the output shape alone. I like it!
 
Following on from this -- how do I pick from a 3d matrix? 1⊃data does not give data[1;;] which I erroneously assumed.
 
@xpqz 1⌷data
 
10:55 AM
Why does the pick rank-error?
 
@xpqz Pick picks (!) individual elements, not cells.
 
So that's what pick picks.
 
11:06 AM
After your suggested array magic, my 76-line python solution of day 20 AoC 2017 shrank to a single line of beautiful apl:
mhd⍳⌊/mhd←+/|¨2⌷+⍀⍣500⊢DAY20 ⍝ Part 1: 170
 
@xpqz I don't think you need the ¨ there, since | is a scalar function.
@xpqz mhd⍳⌊/mhd← can be expressed a bit more succinctly as ⊃⍋
@user11059 Hi brgal. If you want to participate here, then email me: adam@ with the same domain as www.dyalog.com
 
@Adám nice.
 
 
1 hour later…
12:14 PM
@ab5tract This paper from IPSA '82 sounds fairly close.
 
@Marshall that's it!! thank you!
 
Now it can be added to the list!
 
@Adám I took it off the list because it's on the IPSA conferences page...
 
@Marshall Ah, good point, yes. I just noticed that it is linked from there.
One day, when someone has plenty of time on their hands, all these papers from all these sources need categorisation with keywords and stuff.
In fact, that could probably benefit from an APLcart-style interface.
 
It's also a source for APL Blossom Time.
 
12:20 PM
Yes.
@Marshall Would there be any issue with inserting this as an image on the wiki page?
 
@Adám I wouldn't mess with the ACM.
There should be a section on the song contents with links to the rest of the wiki though. I just wouldn't quote it directly. There are plenty of other pages that reprint it.
 
@Marshall But that'd be the full text, no? Just with hyperlinks.
 
@Adám No, just something like "The first verse describes [[Ken Iverson]]'s publication of [[A Programming Language]], describing the notation he had written about before in a more organized and complete way. The second describes the usage of Iverson's notation as a hardware description language at [[IBM]]..."
 
Ugh, rewriting the song…
It'd be much cooler to have this with hyperlinks:
 
@Adám Well yeah, but as an academic publishing service the ACM probably consists mostly of lawyers these days. Not worth the risk.
 
12:36 PM
@Marshall We can legitimately claim we got it from CoSy or Ed Thelen.
Hm, CoSy says "copyright 1981 by Michele Montalbano".
 
@Adám That doesn't work unless they're able to grant us rights. You can talk to Bob Armstrong or Jim Brown to see if you can figure out who owns it and what permissions they have, but I suspect it's just copied without any regard for copyright. That's fine for smaller sites, but APL Wiki will probably become more prominent and we'd rather not attract legal attention.
Same goes for many of the papers on jsoftware.com. In most cases I think Roger has permission from the author, but we still shouldn't copy anything from them onto the wiki.
 
Hm, were idioms (in the non-Dyalog sense) originally called cliches? That would actually be a more appropriate term.
 
Speaking of CoSy... still looking forward to watching the BAA presentation one day :)
 
 
2 hours later…
3:14 PM
henlo
 
Hi. You're back for more?
 
@Adám Is there some documentation on error reporting when running with -script?
@Adám Specifically, it seems that the interpreter always returns success, i.e. even when there is some run time error in the program.
 
@FredrikNiemelä Certainly not with -script, as that is entirely undocumented.
@FredrikNiemelä Ah, yes, I addressed that on TIO. Do you want to meet so I can show you and explain it?
 
@Adám Sure, that would be great.
 
@FredrikNiemelä OK, come to my Zoom room at half-past. I just have finish something.
 
3:24 PM
@Adám +←1
 
3:41 PM
@Adám I literally said that and them closed rthe tab, don't know why lol
but sure!
* then closed the
 
4:13 PM
... or not
 
 
1 hour later…
5:26 PM
@matt Sorry, as you can see ↑↑↑ I became otherwise occupied. Another time!
 
5:43 PM
:)
 
RGS
@Adám why does 4 5 6 + ⍳ 3 3 give a RANK ERROR? I was expecting it to give the same result as ↑4 5 6+↓⍳3 3
 
@RGS most APLs have scalar/singleton extension (args either have to be of exactly the same shape, or one can be a scalar), but that'd require leading axis agreement; see this (unfortunately no page on "Leading axis agreement")
 
@RGS because apl isn't j
 
RGS
@dzaima hmmm, I thought what I sent would work by the same mechanism that makes 1 2 3 4 + ((1 2) 1 (1 (1 3 4))) 4 (4 5 6) (4 6) work
 
@RGS that's the "exactly the same shape" case
 
5:56 PM
@RGS that big array is actually a 4-array
 
RGS
I see, I think I understand; will have to explore a bit more :)
 
(BQN does have leading axis agreement)
 
first element ((1 2) 1 (1 (1 3 4))), second 4, third 4 5 6, fourth 4 6. Then scalar distribution takes care of the rest
@RGS you can try 4 5 6 (+⍤0 1) ⍳3 3
 
6:13 PM
@dzaima Reference-based dzaima/BQN now up here.
Next step is to remove all the redefinitions of primitives that actually work, and then of course more functionality can gradually be moved to the main dzaima/BQN.
It runs as an executable that takes all input from stdin.
 
@dzaima Redirected here for now.
@RGS dfns.dws has perv←{⍺←⊢ ⋄ 1=≡⍺ ⍵ ⍵:⍺ ⍺⍺ ⍵ ⋄ ⍺ ∇¨⍵} but I just came up with an interesting one: _Perv←{⍺←⊢ ⋄ 4::⍺∇⍤¯1⊢⍵ ⋄ ⍺ ⍺⍺ ⍵}
 
RGS
7:26 PM
@Adám why do I do 1=≡⍺ ⍵ ⍵ in perv? and in your example is the 4:: catching a RANK ERROR?
 
@RGS 1=≡⍺ ⍵ ⍵ checks if both and are of rank 0 (as a vector of them would be rank 1); there are 2 so in the case of ⍺←⊢ the 1 = ≡⍵ ⍵ would still act the same (really it could be 1=≡⍺ ⍵ 0 or whatever)
 
@RGS ^ and attempting to use leading axis conformity when the languages doesn't have it gives a RANK ERROR, so we try again on major cells.
 
discussing BQN?
 
@matt No, just normal Dyalog APL.
 
yay apples
absorbs apple into brain (wink wink)
 
7:38 PM
Remember how APL auto-maps, right? 1+2 3 4
 
yep
      1+2 3 4

3 4 5
 
And that you can form lists (vectors) by putting elements next to each other? (10 20)(30 40)(50 60)?
 
yep
      (10 20)(30 40)(50 60)

┌─────┬─────┬─────┐
│10 20│30 40│50 60│
└─────┴─────┴─────┘
 
So, APL allows you to use this auto-mapping to any level of nesting:
         (10 20)30(50 60)+2(3.1 3.2)4
┌─────┬─────────┬─────┐
│12 22│33.1 33.2│54 64│
└─────┴─────────┴─────┘
@matt Understand what happened here ^ ?
 
not exactly.
 
7:42 PM
Both arguments of + have 3 elements, right?
 
right
 
((10 20)+2),(30+(3.1 3.2)),((50 60)+4)
 
@Wezl Almost:
((10 20)+2)(30+(3.1 3.2))((50 60)+24)
@Wezl btw, use backticks or four leading spaces (Ctrl+k) for monospace font.
@matt Understand now?
 
yep
 
That's what we were discussing.
This auto-mapping happens only when the arguments have identical shape (then it pairs up) or when one of them is a single element (then it distributes the singleton to all elements).
 
7:46 PM
"shape"?
 
Yeah, e.g. 2 3+4 5 6 won't work. One has shape 2, the other 3.
 
I see, it pops up a LENGTH ERROR
 
Right, since the lengths don't match.
 
bites apple
 
Now, you know that APL also has multi-dimensional arrays, like the multiplication and concatenation tables we made.
 
7:51 PM
mhm. just out of curiosity, what's a 3d array like?
 
It has layers, each layer has rows, and each row has elements. (Or you could say that the layers have rows and columns.)
 
example?
 
Think of indexing into a book. In order to pinpoint a specific letter in the book, you'd have to give a page (layer) number, line (row) number, and character (element) number.
 
assuming the book is in a monospaced font
cool
 
Yes.
 
7:54 PM
but I meant an example in APL :)
 
Oh, Well, remember how ∘.+ added all the combinations of elements from left and right argument? E.g.:
      10 20∘.+1 2 3
11 12 13
21 22 23
 
yeah
 
The reason the result is a 2D array is because the arguments each are 1D arrays.
 
so you're saying that if we applied the same function to that output... ?
 
In other words, each argument supplies its number of axes (dimensions) to the result.
@matt Yes. Very good!
      100 200∘.+10 20∘.+1 2 3
111 112 113
121 122 123

211 212 213
221 222 223
Remember that APL goes from the right. So the leftmost ∘.+ gets a matrix (2D array) as right argument and a 1D array as left argument.
 
7:58 PM
I just did this:
      a←10 20∘.+1 2 3

      a∘.+1 2 3

12 13 14
13 14 15
14 15 16

22 23 24
23 24 25
24 25 26
 
Yes, these are all 3D arrays. We like to call them "rank 3" arrays to sound more mathematically refined.
 
heh ok
but it doesn't look very 3d, more like a PDF of a book
 
Right, somehow we have to project 3D only a 2D screen, exactly like the PDF.
 
00:00 - 20:0020:00 - 00:00

« first day (1251 days earlier)      last day (1403 days later) »