« first day (1155 days earlier)      last day (1502 days later) » 

7:21 AM
@JeffZeitlin I've never seen that before. The PDF is fairly clear, and the character set limited. Shouldn't be too hard to do some custom OCR there.
 
 
2 hours later…
8:54 AM
I downloaded dyalog for mac, and when I run ⊂ 2 3 it does not display the result with box characters around it, even though the examples under help for Enclose do show them. Do I need to change some setting?
 
Do ]Display
So ]Display ⊂ 2 3
Alternatively you can turn boxing on by typing "]boxing on"
 
9:22 AM
@Jonah ^
 
@Adám thanks
 
@Jonah There are also various settings for the boxing. See ]box -?
 
@Adám do you write your APL in the dyalog IDE or using a vanilla editor like vim or emacs?
 
@Jonah Mostly the IDE, but I'm on Windows where the default IDE is a it more evolved than RIDE. While, VS Code with APL extensions isn't bad, I really need the interactive part of development.
 
Finally, is there an online equivalent of the J dictionary with more info on each verb? And (bonus) a way to jump directly to that or see the info inline from the IDE?
 
9:34 AM
@Jonah Try pressing F1 (optionally with the cursor on a language element) or enter ]help or ]help languageElement
 
Perfect. Oh one more. Any tips for learning given that I already know J well? I found the free online "Mastering APL" but at 800 pages that's a bit overwhelming. I can probably figure most things out with the help you linked and analogizing with J, but figured I'd ask if there's any key pieces of reading I shouldn't miss.
 
@Jonah Don't worry about asking me. It is literally my job to be available here. Same goes for RichardPark.
@Jonah Maybe check out APL Wiki's learning resources?
 
"It is literally my job to be available here." Ah I see...
 
9:53 AM
@Adám I believe 32 down is missing an open paren: abrudz.github.io/crosswords/1
 
@Jonah Yes, fixed. Btw, you can PR against the repo.
 
Noted. Thanks.
 
10:14 AM
@Adám Do you know the historical reasons indexing went from 1-based in APL to 0-based in J?
 
@Jonah While APL started with 1 due to the legacy of mathematics, I think the need for availability of 0 was quickly recognised once Iverson's notation became a programming language, especially when dealing with number bases. But then it turned out that giving the users a choice was even worse, so Iverson settled on 0 for J which was intended as a programming from the outset.
 
So would you consider 1-indexing in APL a wart?
 
@Jonah No. I prefer 1. I don't mind so much having to adjust my indices, other than for golfing purposes. In fact, I wouldn't even mind dispensing with the possibility of a mod-based cyclical indexing; make 1 the first element and ¯1 the last.
The 0th element could conveniently be the prototypical/fill element.
 
"I don't mind so much having to adjust my indices" What's a standard example where this is needed in APL?
 
@Jonah Any of these.
 
10:50 AM
@Adám - You'd think, on the OCR - but I've never encountered an OCR that can actually do a credible job on 9-pin dot-matrix type!
 
@JeffZeitlin Not a general purpose one. It'd have to be tuned for this particular character set.
 
I may just take the time and manually key it.
 
 
2 hours later…
12:55 PM
@Adám Experimenting with Adám ;)
 

Sandbox

Where you can play with chat features (except flagging) and ch...
 
I think that indexing from 0 in any language was a mistake that was routinely indulged in because it made pointers and arrays "interchangeable". C is the most visible example of this, but it's often the way compilers for other languages handle things "behind the scenes"
It's simply not natural to think of arrays with zero-indexing.
 
@JeffZeitlin It is rather convenient that false and true are the first two indices, so you can index with a boolean.
 
Yes, but I question whether being able to convert between types so casually is necessarily a good thing. There's something to be said for Pascal's "type fascism".
 
@JeffZeitlin That sounds like an argument for a distinct (not 0/1) Boolean type.
 
1:07 PM
How would I generate a list of rotations of a matrix in a compact way?

For example, given `m←4 4⍴⍳16` and I want `(¯1⊖m)(1⊖m)(1⌽m)(¯1⌽m)`. Is
there a better way? Seems like it should be possible to express this as a
cartesian product of operations and left-args somehow.
 
@Adám - It is. I have no objection to being able to use non-integers to index arrays, but I'm not convinced that not requiring that to be stated explicitly is a good thing. In Pascal, I'd be able to say VAR FOO: ARRAY[BOOLEAN] OF whatever; to explicitly say that I'm going to index FOO with a boolean.
My experience suggests that such restrictive use of types protects against some errors that are common in C-family languages.
 
@xpqz (Markdown only works in single-line messages, but multiple messages in succession become merged visually.)
 
Aha. I wondered why that didn't work.
 
@xpqz Maybe something like (⊃9 11∘((⊣⊖m⌽⍨⊢)/○))¨×\4⍴0j1
 
/me looks at shoes :(
wowzer
 
1:20 PM
@xpqz Problem is that it isn't an outer product. You're not making all combos of horizontal and vertical rotations.
 
ngn
1:37 PM
@xpqz you could do something like 1⌽¨ under the four rotations
 
@ngn how do you mean?
 
ngn
@xpqz {⍉⌽⍵}\1⌽¨{⌽⍉⍵}\4⍴⊂m
 
Certainly does what I was after. But I need to study that for a while to understand what you've done.
 
@ngn 1⌽¨⍢(⊢∘⌽∘⍉\)4⍴⊂ should work in 19.0: Try it online!
 
ngn
@xpqz 4⍴⊂m makes a vector of 4 nested copies of m. ⌽⍉ means turn by 90 deg. {⌽⍉⍵}\ is a scan that leaves m[0] as is, turns m[1] once, m[2] twice, etc. i think you already understand 1⌽¨. and finally {⍉⌽⍵}\ turns the matrices back in the other direction.
(replaced "rotate" with "turn" to avoid clash with apl terminology)
 
1:47 PM
@xpqz Under is (basically) the operator Under←{⍵⍵⍣¯1⊢⍺ ⍺⍺ ⍵⍵ ⍵} and with that, you can write 1⌽¨Under(⊢∘⌽∘⍉\)4⍴⊂
 
ngn
@Adám cool!
 
"Under" in the sense of "under anaesthesia" where the prep is undone after the main procedure.
 
I really want to learn to think like this. But progress is slow :)
Thanks @ngn and @Adám for patient teaching.
 
ngn
@xpqz is this for sandpile simulations?
 
I wanted to solve the 4x4 "sliding tiles" puzzle.
So given a state m, what are the possible moves?
So I thought: m= m + ¯1⊖m (etc) should give a mask.
But seeing the various Game of Life implementations in APL, I'm sure there are elegant solutions that I'm just not good enough to discover yet.
Basically, generate states where the 2, 3 or 4 neighbours are swapped with the 0.
Given what you just gave me:
⎕←(m ∘ {⍺=⍺+⍵}) ¨ {⍉⌽⍵}\1⌽¨{⌽⍉⍵}\4⍴⊂m ⊣ m←4 4 ⍴ 1 3 5 7 2 4 0 6 8 10 13 12 15 14 1 3
 
ngn
2:04 PM
@xpqz but ⌽ wraps around
 
@AviF.S. Welcome to the Orchard!
 
@ngn yes, not got to that bit yet :)
 
ngn
@xpqz here's one possible solution
 
2:19 PM
Ok, that's nice and compact. Let me digest that a bit...
So i←⊃⍸0=m finds the row and col of the 0?
Nice
And d+⊂i←⊃⍸0=m then generates all possible coordinates from that point, left-right-up-down.
 
ngn
@xpqz correct
 
Aha. And (,⍳⍴m) are all valid coord pairs, and so you find the intersection
 
ngn
@xpqz btw, i disclose-enclose i only because later i need it disclosed
 
So now we now the coords of the valid moves.
So looking at the final bit {⌽@i ⍵⊢m} I understand what it must do, but not quite how it works. It should 'apply' the valid moves to generate the new state.
 
ngn
2:39 PM
@xpqz { } is applied to each (¨) location with which we should swap the 0
so, @i⍵ selects the two cells of the matrix that should be swapped
⌽@i⍵⊢m swaps them
here applies to the list of values selected from the matrix, so the axes on which i (the zero) and (the other cell) lie don't matter. i mean, there's no need for .
d can be generated in a golfier way: ⊢/4 2⍴1-⍳3 3 but i wrote it as (0 1)(1 .. for "readability" :)
 
Where is the fun in readability?
 
@xpqz - Readability is in the eye of the beholder. I'll bet @Adám doesn't have any problem reading APL code, no matter what. On the other hand, I still have to work my way through it one step at a time...
 
@JeffZeitlin Not true at all.
 
I agree. If you don't speak Chinese, reading it would be a challenge. But very readable for the natives. I'm getting to a point where I can decipher APL (slowly). The hard bit is the reverse -- I don't think I'd arrived at @ngn's solution for a while.
 
ngn
@ngn ..or shorter: d←1-⍸3 3⍴⍳2
 
2:51 PM
But someone (maybe here?) said that if a line of APL expresses the same logic as 50 lines of C, it's not unreasonable to spend longer reading and writing that line of APL.
@ngn lolwut?
 
@xpqz - Oh, yes - I tend to come up fairly quickly (for me) with the "naïve" solutions in APL for a particular problem; I'm familiar with the basic elements of the language (at the TradAPL level), but I haven't "internalized" the idioms, never mind the golfations thereof.
Once I see a golfed solution, I can generally work through it to understand what's happening - but originate such? Not within my capabilities (yet).
 
ngn
@xpqz should i explain any part of it?
 
@JeffZeitlin I don't think anyone writes golfed code. We all write more verbose code, and then golf it.
 
@Adám - Point taken, though most of the "more verbose" code that you start with isn't the "naïve" solutions, but the idiomatic ones.
 
@JeffZeitlin I often start with a naïve solution & either golf that or after that spend time thinking of different approaches. Starting with the best approach pretty much never happens
 
2:58 PM
@Adám Brings up a question I've been wondering about. For those of you who write and read trains alot, does it become routine, or do you generally start with a relatively verbose expression and start trying remove the alphas and omegas?
 
@PaulMansour It becomes natural.
 
Good to know!
 
@PaulMansour both happen. I often start with a dfn, convert it to a train, and work on the train, but sometimes starting with a train is easier due to the problem at hand
 
@PaulMansour This is part of the reason I can't deal with the backtick keyboard or "rolling" shifting keys (having to let go of them and press them in a specific order). I tend to hold my APL key depressed and type multiple symbols in a row.
 
3:12 PM
@ngn Miraculously, I think I actually get it, after giving it some thought. I'd not seen the "where" glyph before today.
 
 
2 hours later…
5:28 PM
@dzaima - By "naïve" approach, I'm referring to seriously basic stuff - almost like translating a Pascal or BASIC solution into APL, rather than using the kind of thing found in e.g., APLCart. Even "standard" stuff like outer and inner products don't show up until the "first refinement" of the naïve solution.
 
5:54 PM
@JeffZeitlin sometimes I do indeed start with ¨es in obviously unneeded places & otherwise unAPLy code too. (not often, but still sometimes)
 
6:07 PM
in the cases when i don't start with a naïve approach, i already have a specific algorithm/idea in mind (or have spent a while on coming up with one - a naïve solution often helps thinking of better algorithms)
for example, for this CMC i had these "steps" of golfing saved (first half in dzaima/APL, second in Dyalog; there were other things i tried, but only saved these)
(quick notes on dzaima/APL used there - ⊤A: convert to binary; : {⍺/⍵}; f⍤g: {f ⍺ g ⍵}; f⍛g: {(f ⍺) g ⍵}; A⍨: {A} (with original context of course))
 
6:34 PM
Thanks for the warm welcome @Adám; been meaning to join the chat room for quite some time! I'd be absolutely thrilled, and honored, to intern at Dyalog. I was unable to find a place to apply on the website though. Is there an application one should fill out?
 
6:53 PM
/me is busily keying in the APL source for Star Trek, and is seeing some optimizations already, but wants to ask some questions before applying them. AFTER he gets it all keyed in and verified working.
 
@AviF.S. You can just email careers@dyalog.com
@JeffZeitlin I'd put some value in having code as original as possible run, like I did with KINGDOM.
 
@Adám - Oh, I fully intend to preserve the version I'm keying in for historical interest. But, for example, there's a random function that was a duplicate from BASIC's, which I think is functionally equivalent to roll with ⎕IO←0; that's one possible 'fix' I'd apply to a copy.
 
@JeffZeitlin You mean ?0 ?
 
@Adám - ?0 would mimic the BASIC RND(), yes, but the way it's actually being used elsewhere in the program, I believe that I can replace calls to ⌊(RND×b)+1 with a simple ?b. There's also the use of SIN and COS which are just straight-up aliases for the indicated functions.
And a few other things.
Like there's one place where the BASIC calculation was just copied straight up, but APL's order of evaluation changes what's being calculated; I'd end up correcting that as well.
 
7:10 PM
@JeffZeitlin So it gets the wrong result?
@JeffZeitlin It sounds like the code is a very literal translation from BASIC, meaning it has no APLy value.
 
@Adám - Yes. IIRC (I'm about a hundred lines beyond it, and using the del editor at the moment), it calculates (RND×20+20) which in BASIC would multiply the random by 20 and add 20; in APL, it's going to multiply the random by 40.
 
@JeffZeitlin Yeah, that doesn't look right.
 
@Adám - Not directly, no. But I think my fixes will give it some value.
It should also be noted that the APL code as written is very TradAPL; it was originally for APL\360
 
Of course.
 
@Adám Thanks; will do so after my upcoming big deadline! Quick question: It sounded like me being in the UK was a factor in the invitation, though you did say it'd be online for now... I was intending to return to California (home) this weekend; would it be preferable (as far as an internship is concerned) to stay?
 
7:26 PM
@AviF.S. We've had remote interns. The main locality issue is a political one; getting visas. (Also, are there flights from UK to US now?) The internship wouldn't have to be right this instant either.
 
@Adám - I haven't heard of a complete shutdown ... yet. The airlines here are making funny noises, though.
 
@JeffZeitlin I thought Trump ordered a stop to all European flights, besides for UK (failing in) enforcing total lockdown, allowing leaving home only for 1) infrequent necessary shopping 2) ONE form of exercise a day 3) provide or get medical help 4) travel to/from key work — where "key" means necessary for country to survive.
 
All of that is true! Though there remain flights for US nationals and their family stuck abroad, at least coming from the Schengen Area and other approved ones...
 
@Adám - It's questionable whether he had the power to order that at all; even assuming that it's de facto valid, there has been an exception for repatriating Americans who would otherwise have been stranded overseas. I believe that the UK is no longer an exception, and I believe that Italy, for example, may have closed off even the repatriation option with their own lockdown.
I believe that former Speaker of the House Newt Gingrich is currently stuck in Rome because of it.
 
@JeffZeitlin UK doesn't even want repatriation of its citizens any more. They're told to stay put wherever they are instead.
 
7:35 PM
@Adám - I swear, the whole world has gone (pardon my french) bugfuck nuts over this.
 
Wow! That's interesting, because for the most part the US has been far (far) (is there mark-up here?) more strict than the UK!
 
@AviF.S. - ... which is why the UK was taken off the exception list.
 
Oh wow, they both work! I tried *far* & _far_...
@JeffZeitlin That makes sense
Must say, I'm terribly ashamed that the first time I finally do join the Orchard, I completely distract everyone with totally off-topic conversations...
 
Not to worry; it was kinda quiet anyway, and it's pretty obvious that nobody objected...
 
7:51 PM
 
@Adám Haha, thanks! I looked it up right after, but was afraid of falling behind when I was actually sending the message
@JeffZeitlin Phew! Well, nonetheless, a different topic to attempt to be helpful and redeem my reputation: I'd been meaning to suggest, esp. to @Adám since you made it and are the Dyalog representative here, to add APLcart under the set of "Getting Started..." or "How do I..." links on TryAPL.
I've found it to be a nice resource, and it's listed under dyalog.com/introduction.htm under "Getting Started" as well as one of the Dyalog talks on Youtube. However, I imagine many people getting started begin on TryAPL.
Not only are they missing out but the following link is given instead: Search idiomatic APL expressions under "How do I...?" Potentially an opportunity there to help get it out to more newbies!
 
8:17 PM
@Adám Re the previous bit: Were I accepted, it'd be a real bummer to have to intern remotely, but good to know it's a possibility. As I'm trying to weigh the pros/cons of returning given the new opportunity, do you have a sense of the chances of being accepted? That is, to figure out if it's worth staying just in case I get in!
 
@user336320 Welcome. If you're interested in participating here, just email me: adam@ with the same domain as www.dyalog.com
@AviF.S. You're right. We're moving towards using APL Wiki as a central portal.
 
8:47 PM
@Adám I see, makes sense! As for the returning home, do you have a sense of the acceptance rate? To figure out whether it's worth changing plans to stay (haven't bought the ticket yet) in the hopes of more APL...
 
@AviF.S. I think we mostly accept qualified applicants. At the moment, your location would not matter, as it'll have to be remotely anyway. Only upside to stay here is time zone differences. When you have the time, just send an email with your general background, current APL experience, and what your future plans might be.
 
 
2 hours later…
11:00 PM
What's happening here? I get that in (4 2 3)÷(1 1 5)(1 5 1)(5 1 1) the 4 2 3 is being divided by the "columns" of the boxes on the right (if they were stacked), but I don't understand why. Especially confusing is why this works for boxes, which in general won't have homogenous length.
Related: In J you can do 4 2 3 % 3 3 $ 1 1 5 1 5 1 5 1 1 to get the same result (without boxes), but in APL 4 2 3 ÷3 3 ⍴1 1 5 1 5 1 5 1 1 gives a rank error. I would have expected the latter to work but not expected the boxed version linked above to work. Can you set me straight?
 
@Jonah In APL, arithmetic "scalar" function are pervasive. Compare (4 2 3)÷(1 1 5)(1 5 1)(5 1 1) to a b c÷x y z.
 
⎕←{1=≢⍵:⍺ ⋄ '-'}⌸'aabbc'
 
@TessellatingHeckler Bot is out of commission.
@Jonah APL hasn't adopted leading axis conformability, so you have to use rank () explicitly: ÷⍤0 1
 
@Adám Ah, good oh. That {1=≢⍵:⍺ ⋄ '-'}⌸'aabbc' has an output of --c for finding the letters with a count of 1, but {1=≢⍵:⍺}⌸'aabbc' has no output at all, where I'd expect c alone; but where is the computation going, what's happening?
 
ngn
@Adám or ÷[0]
 
11:07 PM
@Jonah I suggest you read the APL Wiki articles Scalar extension, Conformability, and Leading axis theory.
 
@Adám Ok thanks I'll read those and if I still have questions post again.
 
@TessellatingHeckler Since at least one of the calls causes the condition to give 0, that call has no result, and so an overall result cannot be assembled.
@ngn Yeah, nope. Don't do that unless you're golfing. And certainly, that is bad advice to a Jer.
@TessellatingHeckler You may want to use (∪(/⍨)1=⊢∘≢⌸)'aabbc' instead.
 
@Adám when you say "cannot be assembled", why can't the results which exist be assembled and the absent results be ignored?
 
"the leading axis model and its various incompatibilities with APL had been a major reason to break with APL and create a new language." ... interesting
 
@TessellatingHeckler What if none of them would have a result? Should the assembled result be an empty list? Of what type?
 
11:13 PM
@Jonah writing that as (4) (2) (3) ÷ (1 1 5) (1 5 1) (5 1 1) makes it clearer - same as what Adám said a message down, but with the actual data
 
@TessellatingHeckler Alternative (for simple vector data: ∊{⊂⍺/⍨1=≢⍵}⌸'aabbc'
 
@dzaima thanks, that does help. So given that it looks like the "leading axis conformability" is happening automatically when the args are boxed (ie, the (4 2 3)÷(1 1 5)(1 5 1)(5 1 1) version) but not when they're raw. Is this just a historical matter that the feature could be bolted on to the boxed version because it was added later?
 
@Adám I don't know; yes it should be an empty list .. of whatever the APL equivalent of empty string or System.Object[] is, I suppose. I'm still unsure why {1=≢⍵:⍺⋄''}⌸'aabbc' does work, and the output looks like c but has a tally of 3
 
@Jonah Not really. The behaviour comes naturally from APL's traditional scalar extension plus viewing "boxes" not as solid items but simply as having elements that are themselves arrays.
@TessellatingHeckler Because the result becomes '' '' 'c'
 
@Adám but the result has a depth of 1, and that has a depth of ¯2 ..?
 
11:20 PM
)about
Haha, shoot! That clearly didn't work...
 
@AviF.S. Sorry, bot is missing due to COVID-19.
 
Ah, no need to be sorry!
 
Mention of bot removed from room description
 
Whoops, there it goes! Didn't mean for you to have to rewrite everything due to a small exception, haha!
 
Help me @Adám, you're my only hope!
 
11:22 PM
"The behaviour comes naturally from APL's traditional scalar extension plus viewing "boxes" not as solid items but simply as having elements that are themselves arrays." But by that same argument it seems like it should work without the boxes too... what am I missing?
 
@Jonah Traditionally, APL did not see higher rank arrays as collections of lower rank arrays.
 
Haha, clearly the chatbot is still doing something!
 
"APL did not see higher rank arrays as collections of lower rank arrays." oh so a matrix is its own 2D thing, not a collection of arrays of the same length?
 
@Jonah But yes, it should be added. I'm certainly lobbying for it.
 
"I'm certainly lobbying for it." The issue is backwards-compatibility I'm assuming?
 
11:25 PM
@Jonah Exactly. You can see evidence of this in the behaviour of (membership) which, for each rank zero element in the left argument, checks if such a rank 0 element exists in the right argument.
@Jonah No, it'd just remove RANK ERRORs.
 
So there's no argument against it, just the implementation cost?
 
Not even. I think it is quite easy to implement too. (I can ask.) It is simply conservatism in making any language changes. Notice that (Key) was added in version 14.0 by Roger Hui (of J fame) and does treat arrays as collections of arrays of one lesser rank, so you could get the unique major cells with ⊣⌸, but it took until 17.1 before (Unique) was amended to behave the same. Until then, it only handled vectors. There was nothing preventing the extension other than conservatism.
 
Interesting.
 
On the bright side, I think we're close to adopting a new set of procedures that will accelerate adoption of "obvious" language extensions.
 
"You can see evidence of this in the behaviour of ∊ (membership) which, for each rank zero element in the left argument, checks if such a rank 0 element exists in the right argument." It's funny I've found situation in J where I wished it behaved like this. Related: Wanting to just "sum up" an higher-dim object, regardless of shape, but having to flatten , first. Ofc, I get how this desire goes against the grain of the J / array-think world view, but it's weirdly persistent.
 
11:36 PM
@Jonah The problem is that it is easy to flatten first if that's what you want, but with a primitive that does it for you, the opposite becomes impossible. Another example is A⍴B which is like J's A$,B
 
"but with a primitive that does it for you, the opposite becomes impossible." Yeah, I get that part. My quibble is that, mentally, I don't want to flatten the thing and then add the elements, because thing shape is part of its identity, and I don't want to make a mental shift like that. I want to "add things elements in a shape-ignoring way". So in J terms I want another adverb to modify the meaning of +/, rather than destructure my thing first.
I know I could write one... I'm just talking about language design preferences.
 
@Jonah Meanwhile, you can see some of my suggested extensions here, ranging from the obvious (like ) to the more fanciful (like |).
 
Thanks, bookmarked.
 
@Jonah Ah, that's where you want to use another suggested extension, structural under. It is like J's Dual, but on the structure of an array rather than on its value. So e.g. A∊⍢,B would first ravel A and B, then do the membership, and then put the corresponding Boolean values back into the structure they came from. (Of course, this wouldn't matter with APL's current definition of .)
@Jonah But any meaningful name would be longer than typing it out. It is simply All←∘, so you can do +/All myMatrix — but why not write +/∘,myMatrix or even +/,myMatrix ?
 

« first day (1155 days earlier)      last day (1502 days later) »