« first day (1598 days earlier)      last day (1039 days later) » 

12:03 AM
Presenting: polyfill
 
cool
not a fan of magic constants for reshape but the rest should definitely all be in the language
 
@rak1507 Do you have a better suggestion for auto-shape?
Hm, actually, I might change those "magic" values to be ¯1 ¯2 ¯3 rather than ¯0.5 ¯1 ¯1.5
 
12:44 AM
Done, and added ¯4 to use fills. Now just like BQN's but using negative values instead of functions.
 
 
3 hours later…
3:32 AM
Got my book today :) Diving right in.
Why does ⍴ of a scalar (I think that's the right term) return nothing?
Oh I see. It has a rank of 0
So what's the difference between
x←1
x←1⍴1

x seems to be the same either way, but ⍴ on the second returns 1
 
They look the same, but they are different
1 is a scalar, 1⍴1 is a 1-item vector
      1 ≡ 1⍴1
0
 
But then why does
x←1 2 3
x←3 ⍴ 1 2 3
have the same outcome?
 
1 2 3 is already a vector of shape 3
so reshaping to shape 3 has no effect whatsoever :)
 
Hmm
So why doesn't 1 have a shape of 1?
 
Because 1 on its own is a scalar, whereas "1 2 3" can't possible be a scalar because it isn't 1 number
if you know python, it's sort of like (1) being a number vs (1, 2, 3) being a tuple (but only vaguely analogous)
 
3:44 AM
Ok think I'm getting the idea
 
it wouldn't really make sense for 1 to be actually [1] under the hood (that would cause a lot of confusion and be annoying to work with), but it doesn't make any sense for 1 2 3 to be just a number so the only interpretation is [1, 2, 3]
 
Oh that makes a lot of sense
The default is to just be a number but multiple numbers can't be a single number
 
yep, that's pretty much how I understand it (probably worth confirming from someone who knows APL though - I can hardly say i understand any more than vaguely its train structure :P)
 
Got thrown off by the simple average function
{(+/⍵)÷(⍴⍵)}
Was messing around with it and gave it a single number (which should avg to itself) gave no output
Thanks. I got it now
 
4:07 AM
@hyper-neutrino It's a good intuitive explanation. A technical explanation is that multiple "things" (single numbers or arrays) put together get "stranded", which means they form a new vector containing them.
 
what's the difference between an array and a vector (in APL's context)?
 
A vector ≡ a 1D array ≡ a rank-one array
 
oh
wait, you can write multiple arrays together? i was under the impression that that wasn't really a thing you could do
like, to get a matrix you had to reshape or smth
 
Matrix does require a reshape or a mix. Stranding multiple vectors results in a vector of enclosed vectors
 
that's... a bit confusing. anyway, IIRC i was told there's a difference between a matrix and just sticking vectors in a vector, so now's a good time to ask - what is the difference exactly?
 
4:11 AM
So the two common ways to write a 3x3 matrix containing 1..9 are:
      3 3⍴1 2 3 4 5 6 7 8 9
1 2 3
4 5 6
7 8 9
      ↑(1 2 3)(4 5 6)(7 8 9)
1 2 3
4 5 6
7 8 9
 
(reshape 1-9 as a 3x3, and mix a vector of enclosed vectors?)
 
The biggest difference is that a vector of vectors can be jagged (contain vectors of different lengths), but a matrix can't
@hyper-neutrino Yes
 
@Bubbler ah, that makes sense, thanks
(also from testing i notice reshaping insufficient values repeats elements and mixing jagged elements fills with 0s. which both make sense)
 
And they have different rank, shape, and depth, which heavily affects how all the structural functions work
 
,Y also doesn't seem to work on a vector of enclosed vectors
 
4:16 AM
Because it only flattens the outermost array structure.
 
a matrix has depth 1?
that both makes sense and is sort of confusing
 
A "flat" matrix has depth 1. Of course a matrix (or any shaped array) can also contain enclosed arrays as items.
 
ah. okay. that makes sense
so basically, an array can have any number of dimensions but will still have depth 1
and if it nests enclosed arrays then it has higher depth
but you can have a matrix of enclosed matrices with depth 2 and dimensions 2 and 2?
 
Sure.
      2 2⍴⊂2 2⍴2
┌───┬───┐
│2 2│2 2│
│2 2│2 2│
├───┼───┤
│2 2│2 2│
│2 2│2 2│
└───┴───┘
 
and from what it looks like, does "enclose" (like create a singleton array holding just that element)?
 
4:30 AM
Correct.
 
cool. that... actually makes a lot of sense now. thanks :)
 
 
4 hours later…
8:18 AM
@mo523 if you use ≢ here instead of ⍴ it will work, ≢ of a scalar is 1 as well
 
 
4 hours later…
12:35 PM
@user8773069 @user334436 Hi John Doe and Stilvoid. If you want to participate here, please email access@apl.chat
 
 
4 hours later…
4:23 PM
https://youtu.be/z8MVKianh54
After watching this presentation by Aaron Hsu, and as a programming language hobbyists, now I’m very sold that APL and family is the true functional programming language lol
 
5:11 PM
@WongJiaHau Just don't expect functions to take functions as arguments (not that it is actually often needed), because only K and BQN can do that. See discussion of the subject here.
 
 
4 hours later…
9:17 PM
┌⊖────┐
│ ┌⊖┐ │
│ │ │ │
│ └─┘ │
└∊────┘

I can't for the life of me figure out what exactly is this (prints this for DISPLAY)
 
@ArpitSaxena you could try viewing it with ⎕SE.Dyalog.Utils.repObj
 
0⍴⊂'' probably
 
Yeah that was it. Thanks for that method, that will come in handy
 
ah yep, that. No monospace made me think there was a '|' character in the middle
 
yea I copied it to check
 
9:21 PM
I couldn't figure out how to monospace here
 
as you type multiline, a "fixed font" button shows up on the right side of the chat box
you can also prepend four spaces to each line
 
┌⊖────┐
│ ┌⊖┐ │
│ │ │ │
│ └─┘ │
└∊────┘
 
(but you can't have a multiline message that's partly monospace and partly not)
 
seems to be wider than other characters at least in the font on my system right now
so unfortunately it looks misaligned on my screen, lol. might try to set my font to something that supports more characters correctly
 
RGS
9:48 PM
@hyper-neutrino And do that automagically by pressing CTRL+K
 
ah right, that too
never actually bothered trying that in chat before
 
RGS
Hey @user8773069 , if you would like to chat here, please email us at access@apl.chat !
(So that we can give you access aplwiki.com/wiki/APL_Orchard#Access)
 
CMC: codeforces.com/contest/1538/problem/C in under O(n^2) time
 
right, that's what I thought at the time but doing that in APL will not be very elegant
 
RGS
9:55 PM
@hyper-neutrino yeah, I think it's a spoiler
 
I will try it in Python first and then see if I can figure it out in Jelly and then APL (with my very limited knowledge of APL :P)
 
python has tio.run/##SypKzMxLK03O/v8/KbM4Nbnk/38A (spoiler) which makes it straightforward
 
oh yeah that thing
 
RGS
@rak1507 oooooooooooh I didn't know about that!
 
I did it in python during the actual contest
 
9:59 PM
I think there is a pretty nice nlogn solution
 
I don't really do CF anymore
 
@rak1507 yep
 
:D
 
10:14 PM
I think I have a solution too
 
RGS
Me too, I'll just do whatever he's ↑ doing
 
lol
 
10:32 PM
and i seem to have an actuall working & executable (BQN) solution
 
wonder if you could persuade codeforces to add bqn lol
 
10:45 PM
@dzaima and made an APL port, and a somewhat golfed 30 char BQN one
 
(oops: found bug)
 
(oh, mine just takes as a left arg [l,r] and a as the right arg. Didn't bother doing the whole fancy I/O)
 
wait nvm extended and unicode do different things with ⍸ for reasons
@dzaima yea fair enough I just did the io to 'verify'
as a function it'd be tio.run/##K85JLM5ILf7/…
I assume you did something similar
 
⎕IO←1?
 
10:53 PM
yeah
 
need to figure out that ⌊¨ thing
 
@rak1507 tiny simplification based on mine
 
not sure I understand how the two are equivalent
 
@rak1507 something like this
 
ah, cool, thank you
that's smart although I think my original solution for me anyway is easier to understand
 
11:02 PM
@rak1507 if i bothered to, it'd probably be easier for me to understand too. i barely understand what i did :p
 
number of pairs <= r minus number of pairs <= l-1, so the inner function calculates the number of pairs bit
 
nice
 

« first day (1598 days earlier)      last day (1039 days later) »