« first day (649 days earlier)      last day (2006 days later) » 
01:00 - 20:0020:00 - 00:00

1:07 AM
is there a way to do "outer product for all but me"?
for exampl ∘.,⍳3
1 2][1 3
2 1][2 3
3 1][3 2
or better yet

for exampl ∘.,⍳3
0 0][1 2][1 3
2 1][0 0][2 3
3 1][3 2][0 0
i guess that'd just be the inverse identity matrix × ∘.,⍳3
@dzaima am I able to do ∘.myFunction in dzaima APL?
⎕← {add←{⍺+⍵}⋄∘.add ⍨⍳⍵} 3
 
@nathanrogers
{⍺+⍵}
 
⎕← {add←{⍺+⍵}⋄∘.add ⍨⍳⍵} 3
 
@nathanrogers
2 3 4
3 4 5
4 5 6
 
1:28 AM
@nathanrogers What I can think of is, compute outer product, rotate each row by index, drop one from start (or end), and rotate back
 
 
4 hours later…
5:07 AM
⎕←∘.(≠×,)⍨⍳3
 
@Adám
┌───┬───┬───┐
│0 0│1 2│1 3│
├───┼───┼───┤
│2 1│0 0│2 3│
├───┼───┼───┤
│3 1│3 2│0 0│
└───┴───┴───┘
 
@nathanrogers ^ v
⎕←∘.(,~∩)⍨'abc'
 
@Adám
┌──┬──┬──┐
│  │ab│ac│
├──┼──┼──┤
│ba│  │bc│
├──┼──┼──┤
│ca│cb│  │
└──┴──┴──┘
 
5:57 AM
the calculation I am using returns 0 0 so I didn't need it . Before I figured that out, I was using an identity matrix multiplied by the table and it worked out fine
 
 
3 hours later…
8:35 AM
@dzaima Thanks @dzaima for explaining that so well :-)
 
9:33 AM
@nathanrogers you should be able to, it should accept any given operands
 
 
6 hours later…
3:15 PM
how do I check for division by zero?
 
@nathanrogers What do you mean by check?
 
like, if infin or NaN, 0
I seem to be getting that behavior in one of my versions here
, but then I try to do the ∘.f version and I'm getting ? as my result
 
@nathanrogers If you set ⎕DIV←1 then all divisions by 0 will give 0.
@nathanrogers If you want to error on divisions by 0, keep ⎕DIV←0 (the default) and just use ×∘÷ instead of ÷. For code golf, use can use instead of ÷ for scalars, and ⌹¨ instead of ÷ on flat arrays.
 
@nathanrogers my APL doesn't provide anything for division by zero, consider it undefined behavior.
 
well, in one form, it's returning 0
but when I try to ∘.f it's returning ?
this works as expected
 
3:22 PM
@dzaima I get NaN for 0÷0 and for 1÷0 and -∞ for ¯1÷0 and 0 for ÷0 and for 0*¯1. Odd.
 
bodies are gravitationally attracted to one another, with a special body being the sun as stationary
but you must have 3 oribiting bodies because of the a a⍴ when defining forces
there's probably another way to do that, but I thought I'd try the ∘.{⍺f⍵} approach
 
@Adám That's what javas doubles do, and that's what the standard specifies. The behaviour might change at any point in time though
 
@dzaima You have ¯0?
 
and It is giving me ? when I call norm which includes division
 
@Adám no idea, do I?
 
3:23 PM
 
@Adám huh, that's unexpected. The fact that ¯0 exists makes sense though
 
this is the ∘.f version of attract
which, when calling norm when mag is 0, returns ?
 
@nathanrogers ? generally means an empty array with an undefined prototype, e.g. something like
 
using ×∘÷ worked
but its skewing the results a bit
 
3:28 PM
@nathanrogers Any particular reason you don't backtick APL in your messages? You are of course free to do as you please, but I find it harder to read. Besides, the graduation userscript makes code have darker background, which makes it easier to spot…
 
no particular reason
just forget
any comments or suggestions on what I linked would be welcome and helpful
with all 3 adjusted lines from the first one
 
Wait, code has darker background? I never noticed... ×∘÷
 
also how to fix the bug in the original where a must be > 3 for some reason
 
@Quintec for me it's extremely outstanding
 
...Do I have the wrong userscript
 
3:35 PM
@Quintec I've got a ton of userscripts/styles, don't worry :p
 
here I got rid of all the extraneous definitions
 
@Quintec oh Adám's talking about that theme option available in the gradscript settings
 
Which option?
 
@Quintec this one
 
for clarification I'm really looking for how to do the ∘.{⍺ attract ⍵} version of that. I can't seem to get it, because when I try I'm getting ? ? as the result in cases where the magnitude is 0. But in this version, where the magnitude is 0, there are no issues.
 
3:39 PM
I have that checked, yet nothing changes, hmm
 
@Quintec check & uncheck again, then refresh chat. It does that sometimes
 
Oh wow what in the
I've had that checked for like 4 months, never saw changes until now
Ooh this is cool xD
 
possibly something to do with operations over the larger lists? idk
 
@Quintec I had it checked too :p (but I don't like the theme anyway)
 
This is overly bright
 
3:43 PM
@Quintec Yeah, I wish the dark theme worked.
 
Oh no, the chat theme is for all chatrooms,
 
@dzaima Ooh, I'll have a look.
 
@dzaima Been using this for months, highly recomend.
 
@Adám×∘÷ is just "times the reciprocal"?
 
3:58 PM
@nathanrogers Yes.
 
I wonder why that would be causing me problems then. or if there's a bug somewhere else :/
 
@nathanrogers {⍵⌷¯1 1}¨ ಠ_ಠ
 
@dzaima Isn't that the same as ⊇∘¯1 1 or ¯1 1⊇⍨…?
 
@Adám practically it's the same as ¯1+2×
 
@dzaima for a moment there I thought ಠ_ಠ was the name of the variable
 
4:03 PM
@dzaima Yes, that I know. That's classic APL.
@Cowsquack You also don't use the userscript then.
 
@Cowsquack DOMAIN ERROR >.>
 
not for chat, but also I don't use chat much lately
 
@dzaima that's for another assignment, where you're supposed to have a ball bounce off the edges of the screen
so the direction is multiplied by the result of that
-1 for when it's false, 1 for when its true.

If the velocity is x=5 y=3, and the location is out of bounds of the screen, then the velocity ×← -1
or is there some other idiom for that from booleans?
or is it the each?
I can't figure out how to multi index arrays in @dzaima apl
 
@nathanrogers f×str shouldn't this be the norm of f times str?
 
there's too many idioms :( I just want to arr[list of indices]
@Cowsquack I don't know, I don't think so?
from the example that was given, that wasn't mentioned
 
4:17 PM
the magnitude of the force of gravity is calculated with (G×m×M)÷r×r
 
yes, I think norm of the distance is what we're calling force
 
@nathanrogers indices ⊇ arr
 
I meant "normalised" not norm
sorry
 
i can't type that
what is the combo for that?
 
4:19 PM
yesterday, by dzaima
@Adám yeah, I've been too lazy to make it, and there already is
 
so the actual force would be mag × normalise(force)
 
@nathanrogers ...
 
@dzaima doesn't work for me
/s
 
@dzaima ?
 
@nathanrogers there's a link there.
 
4:22 PM
what about the link @dzaima
 
ok I could swear it wasn't a link until you mentioned it
 
@nathanrogers it's to the same exact question by you, already answered
 
sorry. I missed it. I don't know how to type it though
just like the sqrt. awesome but I can't type it
 
@dzaima Odd, TamperMonkey doesn't load when opening the install link.
 
@nathanrogers ok sqrt isn't typable without a compose key (WinCompose exists IIRC)
 
4:24 PM
and ⊇?
 
@nathanrogers How do you type APL chars normally?
 
@Adám most of those are userstyles, for which you need Stylus
 
using the dyalog keyboard
with ctrl
left shoe and right shoe are ctrl +z and ctrl+shift+x
 
@nathanrogers use Adám's keyboard, it doesn't use up ctrl
 
@nathanrogers Doesn't it disturb you that it clashes with Ctrl combos of other applications?
 
4:26 PM
yes
 
@nathanrogers ^^^
 
i mean, c'mon guys. I'm on month 2 of using APL daily.
cut me some slack. I don't know things
 
@nathanrogers Hehe, we are just excited. Never mind us.
 
i'll have to install the keyboard at home. lots of steps
the link to msklc... windows surface pro 6... me wants
 
4:45 PM
@dzaima OK, installed, but my own messages are black on dark gray :-( Never mind, that was with graduation script as well.
 
right, should probably mention that it needs gradscripts chat theme off
 
@dzaima With 100% zoom, [search] gets wrapped.
 
@Adám on what monitor size?
 
@dzaima 1920×1080
@dzaima Oh, never mind, it is the graduation script's fault. It changes [site rooms] to [site-name-is-very-long rooms], even when chat theme is off.
 
@Adám huh, it doesn't for me. You sure you're on the latest version? (4.0.9)
 
4:53 PM
@dzaima yup
 
the only modification from the gradscipt I see in the chat is the icon changed
 
5:45 PM
minimal gravity example tio.run/…
displays 10 moving white identical masses as they are affected by gravity
(trail intended) it would be nice if there is an easy way to specify the colour of multiple points
 
@Cowsquack I've wanted that too but couldn't think of a good way
 
I would suggest ⍺, but that's taken up by strokeweight
 
also ⎕div doesn't exist on my APL, so it works just like setting a regular variable
 
hence the 1⌊ :)
also idk a short way to do bounds checking, ie checking whether a point is the screen or not
 
@Cowsquack dyadic would be the answer, but I don't have it implemented
 
5:51 PM
well true
 
not sure I agree with Dyalogs ⎕IO←0 version of that
 
@Cowsquack a fancy (colors for points, bounds checking, different masses) version of this in pure processing is just above 30 lines, so removing the fanciness would prolly bring it to 30 lines of code, compare that with the apl equivalent
well I also stored the points as objects, that might contribute to some of the verbosity, but still there a lot
@dzaima oh I just realised I had a rogue ⎕div←1 in there forgot to remove it >_>
 
6:12 PM
I have 2 tables of the same shape, I would like to get the subtraction of the first row and the multiplication of the second row
Im' trying some kind of (-,x)/⍉t1 t2
but that's giving me the - and x of both rows catenated together
 
something like this? (doesn't work in my APL because implementing dyadic would be a nightmare)
 
oh so columns instead of rows
 
but basically, I want the upper left and bottomw right quadrants
 
ngn
6:27 PM
@nathanrogers ⍉a b is the same as a b
 
yeah, because I have x y vectors representing locations and masses,

lx ly mx my
but then I have another location and mass
lx2 ly2 mx2 lmy2
so it would be neat if I could simply
(-,×) lm1 lm2
and get l2 - l1, m2×m1
 
@nathanrogers what's lm1 & lm2 there?
 
you see I have colums yes?
locations are column 1, masses are column 2
in both a and b
 
and so what is lmN? It's neither location nor mass..
 
I guess a better example would be a 6 2⍴⍳12 so that each column is even length
oh, lm is column1 is location m is mass
so lm1 is a ⍉location mass
1 sec
 
6:31 PM
@nathanrogers ⍉A BA B
 
lm2 (-,×)lm1
but then I want the uper left and bottom right quad, shape of lm1
 
@nathanrogers if the two parts are different types of information, I would suggest not even joining them up ever (until needed, e.g. for the drawing functions)
just do l2-l1 & m2×m1, it's not that much work and is probably shorter than anything one could come up with with them joined together
this is what I'd do if I got given them together
 
they're being joined as arguments to a function
 
@nathanrogers don't join them as a matrix, IMO it makes zero sense to store position & mass as two columns of a matrix
 
it makes perfect sense when you're using position and mass as columns in a table
they relate to one another
especially when you have multiple vectors pertaining to the same object
mass, locaiton, velocity, forces applied, acceleration
 
6:42 PM
@nathanrogers but at least to do calculations on them you really should just split them up
 
@dzaima Wait, is a general-purpose prefix char?
 
@Adám kind of, it's a side-effect of my lazy implementation of it. Though that might change at any point in time
 
@nathanrogers why keep forces applied separate from acceleration?
 
because acceleartion may be different than the forces applied. Imagine a car accelerating with wind gravity and bomb explosion forces on it
I though tthe same thing, but I've had a few examples where the acceleration varies independently from the forces applied to it
 
for each separate force, you can add them (multiplied by the mass) to the acceleration instead of keeping them in a seaparate column
 
6:48 PM
I don't follow
force isn't a column
 
"mass, locaiton, velocity, forces applied, acceleration" oh this is not all in one matrix?
 
I transform it into a column for simple operations accross the rest of the columns, the thing is I don't have a simple way of passing both location and mass to a function taht I need to call
no they're all single vectors
but I have to join location and mass because I need them both in a function for a single calculation
 
then why not keep them separate as dzaima said :|
 
they are
 
@nathanrogers why not pass a vector of the vectors ._.
 
6:49 PM
I'm doing that right now
 
@nathanrogers no, you're passing a matrix :|
 
the pooint of my question is to see if I can simply apply a vector of functions accross amatrix
that would only make sense
no my question is about passing them as a matrix
 
@nathanrogers no, it wouldn't. Calculations stay separate
 
which is silly
 
@nathanrogers and the answer is "no, don't."
 
6:50 PM
J's gerunds might be similar to what you want, but I am not sure because I've never used them
but that's J
 
In linear algebra, a rotation matrix is a matrix that is used to perform a rotation in Euclidean space. For example, using the convention below, the matrix R = [ cos ⁡ θ − sin ⁡ θ sin ⁡ θ ...
that's a perfect example of when I might want a matrix of functions
 
@nathanrogers no it isn't. If it was more complicated, e.g. add the speeds to the locations, there would be no way to make that in that format
 
@nathanrogers (2 2⍴2 ¯1 1 2)○angle
 
there are really standard ways to apply vectors to matrices
 
actually parens can be removed
you don't need multiple functions, just one, in that case
 
6:52 PM
@nathanrogers that takes only one arg, not multiple, each for each column.
multiple functions for one input makes sense. one function for multiple collumns makes sense. Different functions per different columns doesn't make sense, as there's no reason to join them up, if they each need distinct operations.
 
⎕←((↓2 6⍴⍳12) (+,×) ↓2 6⍴⍳12)[1 4]
 
@nathanrogers
┌─────────────┬────────────────────┐
│2 4 6 8 10 12│49 64 81 100 121 144│
└─────────────┴────────────────────┘
 
0+1*2+3*4+5
29
+`*/0 1 2 3 4 5
29
J gerunds
 
@Cowsquack no idea what they are, but looks ugly.
 
6:58 PM
@dzaima They are like nounified verbs (arrayified functions). / applies them in order and cyclically.
 
@Cowsquack I don't know J in general though :p
@nathanrogers see, even you there are converting the matrices to a vector of the first & second row...
 
@Adám is there really no way to do this in apl without the extra computation?
⎕←((+,×) ⍨↓2 6⍴⍳12)[1 4]
that's how they're being passed into my function right now
 
@nathanrogers then change that passing to a vector of vectors.......
 
they're coming in and I say loc1 mass1 ← ⍺⋄ loc2 mass2←⍵
which is a vector of vectors
 
@nathanrogers when why are 2×N matrices involved?!?
 
7:01 PM
but it'd be cool if I could say ⍺(+,×) ⍵
because I just figured that I could apply a vector of functions to a matrix
because that would only make sense. since we're all about notation and all
 
⎕←((+⍨1∘↑)⍪(×⍨1∘↓))2 6⍴⍳12
 
@Adám
 2  4  6   8  10  12
49 64 81 100 121 144
 
@nathanrogers there'd be close to zero use-cases for that, in comparison to literally every other syntax in APL
 
This one looks fun:
⎕←1((↑+↑)⍪↓×↓)2 6⍴⍳12
 
@Adám
 2  4  6   8  10  12
49 64 81 100 121 144
 
7:03 PM
for me, a matrix signifies that it all contains one type of data - either position or speed or whatever, but not both.
 
a matrix is just another name for a table
and tables do NOT all contain the same type of data
 
@nathanrogers personally, I wouldn't ever make a table that doesn't all contain the same type of data. That's what vectors are for
 
@nathanrogers Sure, but then we normally index to get the right column when doing computations.
 
i have them as vectors @dzaima. I've said that a dozen times. I am joining them as a vector of vectors to pass to a function
but
for the context of THIS question
I asked if there was a way to apply a vector of functions to a matrix
 
@nathanrogers and the answer is no, and it shouldn't ever be done.
 
7:06 PM
which
is silly
 
@dzaima Actually…
 
@nathanrogers I disagree.
 
I mean, you're disagreeing with Roger and Ken and the like because they made J
 
@nathanrogers so be it
 
in which there are arrays of functions
As with K.
So, for that reason, I was asking if it was possible in APL. I think its silly that functions aren't actually first class, and that only operators are when the other 2 anscestors of the language saw fit to add them.
 
7:08 PM
heh, this conversation made me think again about implementing first-class functions again and it made me realize that that's a bad decision
also from a memory perspective: imagine if you want to store objects, each with a boolean and a number property. Storing them in a matrix would force the booleans to all be stored as full numbers (persumably 64-bit ones), whereas a vector of the booleans & a vector of the numbers could easily store the booleans as bit booleans
also if another property you'd want would be a string (aka a char vector), the matrix of everything couldn't even be stored as a number array
 
that's fine, and I 'm not storing things as single matrices. I'm storing them as vectors
 
⎕←'+×'{(⍎⍺)⍨⍵}¨↓2 6⍴⍳12
 
@Adám
┌─────────────┬────────────────────┐
│2 4 6 8 10 12│49 64 81 100 121 144│
└─────────────┴────────────────────┘
 
but, at some point I need to perform calculations which pertain to more than 1 vector
for instance when I need to multiply the distance by something to do with the mass. I need locations and masses of each object, so... it would be COOL if I could find some kind of way to apply functions accross those vectors while I still had them joined together
 
@nathanrogers then just do dist×← doSomethingWith mass
 
7:16 PM
⎕←((+,×)⍨↓2 6⍴⍳12)[1 4]
this looks notationally clean to me
 
@nathanrogers
VALUE ERROR
 
@nathanrogers But that means something else. Hence J uses (+`×) (well, kind of).
 
no I get it, but what I'm saying is, there's probably an idiom there that I thought perhaps I was missing
 
⋄ (nss←⎕NS¨⍬⍬)[1].f←+ ⋄ nss[2].f←× ⋄ arrayOfFns←nss.f ⋄ ⎕←arrayOfFns⍨↓2 6⍴⍳12
 
@Adám
┌─────────────┬────────────────────┐
│2 4 6 8 10 12│49 64 81 100 121 144│
└─────────────┴────────────────────┘
 
7:19 PM
@Adám ..what..
 
@dzaima Yeah ⍨ Dyalog APL does allow arrays of functions — if you force it.
It also has symbols — if you force it.
 
What even is wrong with an array of functions
 
@Adám ok now I understand how ngn felt about the news that k was getting unicode
 
@Quintec They don't quite fit into the traditional APL world view.
@dzaima And that is how?
 
Change it then '-'
 
7:23 PM
Oh, I remember why I had them as matrices instead of vectors, because I need to ∘.{⍺ f ⍵} so I need the discreet mass and locations of each
 
Oct 5 at 15:48, by ngn
@Adám is that a joke?
 
@nathanrogers But there is an equivalent expression to ∘. for vectors of vectors.
@dzaima Oh :-D
 
but it isn't a vector of vectors
 
@Adám I like the array of namespace solution. In addition you can put the vector in the namespace and associate other metadata with it. Effectively a class. Very useful.
 
for instance locations is all locations, masses is all masses
(locations masses) ∘.{⍺ f ⍵} locations masses
doesn't work
but this does

∘.{⍺ f ⍵} ⍨ ↓,/{⍬ 2 ⍴ ⍵}¨locations masses
 
7:26 PM
@nathanrogers Ugh.
 
that took way too long.
 
^^. No idea what to do for ∘.
 
 
as I said this morning, I'm open to any suggestions for how to improve this
I was playing around with the attract function, and thought I saw an opportunity for (-,×) or some other such thing, so I was asking questions
I was trying to make a mce or w/e @dzaima because that's what I was told I should do
and specifically, I need help with the bug having to do with a a⍴... when generating forces. becuase if there are locations < 6, (a< 3) then there is only 1 result but 2 pairs? or something... and the balls disappear off into infinity land
I'm all ears as to coding style and how to fix the thing so there's less of this "join" and "vecs" nonsense every which way. then there's the sun...

@dzaima why is it that (sun←origin,100 100) is not the same as (sun←↓2 2⍴origin, 100 100) then (,/sun) ? they both have length 4
 
7:34 PM
@nathanrogers Look at them:
 
@nathanrogers they should be equal?
 
in dyalog they aren't
in your REPL the shapes match
 
⎕←1 2,101 102 ⋄ ⎕←↓2 2⍴1 2,1 1 ⋄ ⎕←,/↓2 2⍴1 2,1 1
 
@Adám
1 2 101 102
┌───┬───┐
│1 2│1 1│
└───┴───┘
┌───────┐
│1 2 1 1│
└───────┘
 
@nathanrogers in dyalog f/ vec returns an enclosed array. In my APL it doesn't.
 
7:35 PM
Oops, last 1 1 should have been 101 102, but you get the idea.
 
> ⍴,/↓{⍬ 2⍴⍵} (200 200), 100 100
4
> ⍴(200 200), 100 100
4
 
@nathanrogers In Dyalog f/A always (well, except if A is a scalar) reduces the rank of A. Always.
 
@Adám note: reduces = removes one item from the shape
 
@nathanrogers Btw, why do you use a dfn {⍬ 2⍴⍵} instead of just ⍬ 2⍴?
 
because sometimes it's many and I need ¨
 
7:38 PM
@dzaima Yes, in particular, f/ removes the last item of the shape, while f⌿ removes the first item.
@nathanrogers ⍬ 2∘⍴¨
 
yes we aren't only talking about single pairs of values. we're talking about many pairs
that seems to work in my code
so I don't get why in @dzaima's they don't match
because by all appearances they do match
> a≡,/↓⍬ 2 ⍴ a←(200 200), 100 100
0
 
@nathanrogers if the result of / is a scalar (⍬≡⍴), I automatically do a after
 
except they don't
 
@dzaima Huh ^ is right. What's going on‽
 
@nathanrogers ok that must be a bug
 
7:43 PM
@dzaima Do you have an equivalent of ⎕SE.Dyalog.Utils.repObj?
 
So there's that question, but then generally, I'm interested in understanding better APL writing. In this example, I have lms∘attract¨join lms I was trying to do a ∘.{⍺ attract ⍵} ⍨join lms or something to that effect, but I don't know if my current implementation may be faster? since I'm applying ...¨join lms to lms all at the same time?
So there's the question of efficiency, but that a a⍴... bug where a must be > 3 or the balls disappear is gnawing at me
 
@nathanrogers Also, {⍺ anyfunction ⍵} is the same as anyfunction.
 
@Adám no, the best way to get more data of printing objects is )quote and )oneline
 
@dzaima How do I use them?
 
@Adám I can't figure out how to ∘.anyFunction in @dzaima 's apl
that's why I wrapped it in {}
 
7:47 PM
@nathanrogers So with {} it works?
 
@Adám this (or as flags)
 
@dzaima ⍨
@dzaima ^^^
 
> add←{⍺+⍵}
{(⍺ + ⍵)}
> (⍳3) ∘.{⍺ add ⍵} ⍳5
(⍳3) ∘.add ⍳5
^
java.lang.ClassCastException:
 
!
 
7:49 PM
@nathanrogers oh yay that's another bug (the same type one that made it so {var} didn't work)
 
sorry @dzaima I'm really enjoying using your app thing, so I'm not complaining
except that whole no vector of functions thing... but elsewise, I'm just trying to get things working, I don't mind a few bugs, it's all water under a ducks back
I mean water off a bridge
onto a ducks back
then under it?
 
🦆︎
 
but I would really like to figure out the a a⍴... bug in my code
how can I make it work for any number of balls, not just balls > 3
its sort of the n queens problem where there are no solutions on boards < 4 x4
the balls sort of fly off into neverland with less than 3 balls
 
that whole forces expression is pretty hideous.

I would just like to take the time to point out that in "pretty hideous" is a valid English statement, and makes no sense
 
7:54 PM
@nathanrogers No worse than "the shirt is a little big for me".
 
The horse ran past the barn fell, after all.
 
oh im stupid 1 2≡1 2 gives 0.....
that's why i don't like optimizing things
 
01:00 - 20:0020:00 - 00:00

« first day (649 days earlier)      last day (2006 days later) »