« first day (734 days earlier)      last day (801 days later) » 
00:00 - 22:0022:00 - 00:00

10:00 PM
I have something to work with I'll let you know
can I do value unpacking in args list?
{[(a;b;c);x] ...} @ngn
 
ngn
@nathanrogers no, but of course you can do it in the function's body
{(a;b;c):x ...}
 
I mean for x,y {[(y1;y2;y3); x] ... }[(1;2;3); 10 10#0]
 
ngn
@nathanrogers any reason for swapping x and y?
 
no
again, this is 1 row
of a long table
 
ngn
it could be {[y;x] (y1;y2;y3):y ...} or if it's ok to use the implicit order of x,y: {(x1;x2;x3):x ...y...}
 
10:10 PM
what are the syntax rules of that unpacking?
just any old expression can follow it after a space/
 
ngn
@nathanrogers unpacking works like an each-ed assignment
 
but there's no ; after?
as an expression separator?
 
ngn
@nathanrogers oh, if you have other statements after it, of course, you should put a ;
 
ngn
i omitted it from the examples only to reduce clutter
 
10:26 PM
{{(!y)\:/:!x}. {x|-x} x-y}[2 4; 5 5]
@ngn i can't seem to pass the results to the final expression there
the result of the absolute value should be 3 1
I want to pass 3 1 to the last expression on the left, I could do assignment?
{(!*|x)\:/:!*a:{x|-x} x-y}[2 4; 5 5]
but I keep getting rank error
 
ngn
@nathanrogers shouldn't there be a verb before \:/:?
 
oh, hjaha
derp
 
ngn
"rank error" because you were trying to apply (!y)\:/: to fewer args than required
 
{[a;b](!*|z){(&/x)+y,z}[(a;b)]\:/:!*z:{x|-x} a-b}[2 4; 5 5]
ok this does what I want
but its convoluted as shit without lexical scope
 
ngn
@nathanrogers yes :( that can be painful
 
10:31 PM
really, there should be a ⍳ n m
 
ngn
@nathanrogers "find"? it's x?y
 
index range
I want like a (⊂2 4)+⍳2 3
 
ngn
@nathanrogers i think the odometer is better than apl's ⍳
@nathanrogers 2 4+!2 3 ?
@ngn it gives you a mixed wide matrix instead of the inefficient nested thing ⍳m n gives in apl
 
oh!
its like a ↑,⍳2 3
 
ngn
@nathanrogers yeah, and transposed
 
10:36 PM
neat
ok
there's no abs then?
 
ngn
@nathanrogers no, but i can see you figured it out: x|-x
 
@ngn (would be nicer if each item also had a shape :) (cause of course i have to mention dzaima/APLs ⎕vi←1))
 
@ngn does @[...; index; ...] accept a list of indices
or only 1 index
 
ngn
@dzaima i remember seeing this before but i can't remember what the motivation was..
 
@ngn i've surely mentioned it in every chance possible
 
ngn
10:40 PM
@dzaima so, ⎕vi changes ⍳⍵ to ↓⍉⍤2↑⍳⍵?
 
@ngn and other things that do with arrays of indexes - @, ; vi being "vector indexing"
 
ngn
@nathanrogers it accepts lists too, and even lists of lists, and can penetrate them (depends on other args)
@dzaima that's a much better definition of ⍳ but alas, such things in apl are set in stone
@nathanrogers btw, i added \+ \' etc
i hope nobody ever uses help and repl as variable names in the repl :)
 
ok I'm almost there
i:(("e"; 2 4; 5 5);("n";3 1; 8 8))
a:"efg"!({~x};{1};{0}) /actions
{@[y; \,+{(x&y)+!{x|-x}x-y}.1_x;a@*x]}[*i;10 10#0]
i is the input a is a dictionary of actions
this say in y, ammend index range of the last 2 elements in x, by action a
but its amending the entire row
and not the indices
 
ngn
@nathanrogers so you want to start with 10 10#0 and go through the actions and apply them in order?
 
right, but this is one step
 
10:49 PM
@nathanrogers is {&/[x;y]+/:+!|{x|-x}x-y}[2 4;5 5] equivalent? its result doesn't enlist each uhh, list in the list
 
i f / 10 10#0
 
ngn
@nathanrogers but they are different actions
 
I was only + and , to see if my argument was wrong
those don't have to be there
 
ngn
i mean, amend can apply a verb to multiple indices, but only one verb
 
right its amending 1 verb
the verb specified by *x in a
a@*x is the function to amend for a given step
1_x is the range
so I'm trying generate indices for that 1 step
hence {...}[ *i; ...]
because I just want to get 1 step right
 
ngn
10:52 PM
i see
 
but its ammending the entire 3rd and 4th rows
not just the index range
which looks correct
 
ngn
@nathanrogers ah, in this case you need "dmend" (amend in depth)
 
oh, so amend is major cells?
.[y; inds; f] ?
 
ngn
.[a;i;f;b] is almost the same as @[a;i;f;b] but when i is a list it goes deeper into a
 
what is b?
 
ngn
10:55 PM
@nathanrogers sorry, without b. it's an optional argument when f is dyadic
but in this case you don't need it
 
no its still amending the whole row
 {.[y; \,+{(x&y)+!{x|-x}x-y}.1_x;a@*x]}[*i;10 10#0]
,(2 4;3 4;4 4)
(0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 1 1 1 1 1 1 1 1 1 1
 1 1 1 1 1 1 1 1 1 1
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0)
 
@ngn I know that's true with @ but does it also apply to .?
 
ngn
@coltim it looks like i haven't implemented all of the cases :(
 
so this won't work for now?
 
ngn
@coltim .[x;y;z] is a bit tricky because it's also "try" (when x is a function)
@nathanrogers let's start with something simple, this should work: .[10 10#0;3 4;:;1]
 
10:58 PM
@ngn ahh, yeh that's what I was referring to
 
.[10 10#0;(3 4;4 4);:;1]
right and this works too
'nyi
not yet implemented ?
 
ngn
@nathanrogers for negation you can use .[10 10#0;3 4;=;0]
@nathanrogers yes :) arthur uses that abbreviation, so all k-s do too
 
@ngn with this workaround, maybe {y .[;;=;0]/{&/[x;y]+/:+!|{x|-x}x-y}.1_x}[*i;10 10#0] ?
 
ngn
@nathanrogers ^
 
11:06 PM
could do a function applied to a range
 
ngn
@nathanrogers so, if you have to perform an action on an m×n region, you generate m×n pairs of indices?
 
yeah
then a look up and perform some kind of multiplication, since its all 1's and 0's
 
ngn
perfomance here probably doesn't matter much, but it could be more efficent if you generate ranges separately for the two axes
 
ok what?
 
ngn
@nathanrogers it's equivalent to a:10 10#0;a[3+!4;4+!5]=:0;a
 
11:10 PM
yes I have my terminal open and I ran it
I don't understand the output
 
@nathanrogers I think it's this
 
can you explain what it's doing?
I don't see indices
 
ngn
@nathanrogers 3+!4 are the indices for the first axis, 4+!5 for the second
 
I see that
 
ngn
they identify a certain set of cells, a rectangle in this case
 
11:13 PM
yes but the don't specify two dimensional indices
 
ngn
the verb is applied to the cells in that rectangle - boolean not
 
oh
so you're just apply =0 with each row and each column in that list
 
ngn
@nathanrogers the list (3+!4;4+!5) is of length 2, so..
 
right but aren't those single cells?
 
ngn
@nathanrogers not to the whole row/column. only to the rectangle.
 
11:14 PM
(3 4 5 6
4 5 6 7 8)
3 4
4 5
5 6
...
that doesn't look like the result
 
it's like right-recursive indexing or something, @ngn can explain it better =P
 
ngn
@nathanrogers to build intuition, try making a small rectange of letters and indexing it in various ways
 
i don't have any intuition because that isn't a list of indices
which is what the argument of that position is meant to be
 
maybe this ? it's not super intuitive to me either
 
I don't have any frame of reference for passing lenghts along 2 indices and not the indices themselves
yes but that \: isn't called anywhere
 
ngn
11:20 PM
@nathanrogers you're thinking of something like scatter indexing in apl. it's not that. it's more like ⌷-indexing.
 
yeah I've never understood ⌷ indexing either
i just get the indices I want in a list and do A[inds]
 
ngn
@nathanrogers yeah that's scatter indexing
 
you mean indexing
 
ngn
think of A[i;j] where i and j are int vectors
 
oh
sure
 
ngn
11:22 PM
(that's the same as i j⌷A)
 
i never knew
 
ngn
and k's dmend (.[a;(i;j);...]) works the same way
 
{.[y; \{(x&y)+'!'{x|-x}x-y}.1_x;=;0]}[*i;10 10#0]
so that way from the original solution
i:(("e"; 2 4; 5 5);("n";3 1; 8 8))
a:"enf"!(=;{(#x)#1};{(#x)#0}) /actions
{.[y; \{(x&y)+'!'{x|-x}x-y}.1_x;a@*x;0]}[*i;10 10#0]
always pass 0, but ignore 0 I guess
 
ngn
@nathanrogers wouldn't it work with {1} and {0}?
instead of {(#x)#1} and {(#x)#0}
hm.. maybe not
 
right
that's what I thought
 
ngn
11:35 PM
@nathanrogers what's the expected output?
 
the matrix
t:10 10#0
i:(("e"; 2 4; 5 5);("n";3 1; 8 8))
a:"enf"!(=;{(#x)#1};{(#x)#0}) /actions
s:{.[y; \{(x&y)+'!'{x|-x}x-y}.1_x;a@*x;0]
so given the initial value t, and the input list i, with actions a, I need to use the solution s for each i, accumulating t
 
ngn
t s/i
 
lmt
what is lmt
 
ngn
@nathanrogers limit error
 
oh my arguments are backwards now
 
ngn
11:42 PM
yes, i forgot to mention
 
'rnk
{[x;y;z;u]@[x;*y;.[;1_y;z;];u]}
^
this isn't anything I've defined
 
ngn
i:(("e";2 4;5 5);("n";3 1;8 8))
a:"enf"!(=;{y;1};:) /actions
(10 10#0){.[x;{x+!y-x}'/1_y;a@*y;0]}/i
and i must go to bed
 
@ngn that solution works if the elements are in sorted order
oh, no I see what you're doing
nvm
this isn't my function
 
ngn
@nathanrogers some of k is implemented in k :)
 
what is '/?
I see, each element is 2, and we're reducing them by the sum of the right with the indices
but that still assumes order right?
 
00:00 - 22:0022:00 - 00:00

« first day (734 days earlier)      last day (801 days later) »