« first day (404 days earlier)      last day (1131 days later) » 

12:55
rng:&&0,
13:11
@richie nice
'Where' is eerily common in short, fast solutions
@Traws i like this if we don't assume & or # are available
although it's not quite right for the zero case
13:34
@chrispsn yes, it should be {-1+\x(1,)/`i$()}
@Traws @richie - added, thanks. If take exists then it looks like icsa's ({&x#1}) is a little faster, but i love that it only needs to use where, and list literal syntax gist.github.com/chrispsn/…
also worth noting k7 (but not yet k9?) deferred execution of !x - not sure how this whole thing should account for such cases
 
2 hours later…
15:49
Another option for length is {y+1}/
16:13
Scratch that that code is so wrong it's not even funny haha
Assuming the count of a scalar is 1, would 0+/{1}'(), work? (at least in k7)
Yeah that should work. The idea I wanted to express was 0{y;x+1}/
ngn
ngn
@coltim in k9 / is eachright and there's no way to give an initial value for reduce
but this could work: {y;x+1}/0,
16:29
ooh, that's pretty clever!
ngn
ngn
not really. it's just start with 0, go through the elements and add 1 for each.
the only tricky bit is that you must force the function to be dyadic
I guess I expect / to "use" the input data, vs. it being a for loop on the count
(in other languages it'd be the difference between a for loop and a forEach loop)
16:57
Here's where in k4/k7
w:{-1+,/l+!#l:~-1=!:',/,x}
Assumes ! Exists
 
3 hours later…
20:29
It feels like a +\ soln could work for where
Or an index into the original array
21:22
which is what 'k tech tree' has listed already
21:36
looking for something that doesn't involve nested arrays
ngn
ngn
21:51
@chrispsn {+/~(+\x)>\!+/x|:0} ?
still uses nested though :( what was that thing with step functions?
 (`step 0 2 3!"abc")@!4
"aabc"
ngn
ngn
thanks
@ngn at least there's no catenation
ngn
ngn
22:10
seems it should work with step functions, but i'm running into bugs
{1+(`step(+\x)!!#x)@!+/x|:0}
@chrispsn {1+(`step(-1,+\x)!-1,!#x)@!+/x:0|$[x~*x;,;]x}
I've been tinkering with something you folks might find interesting. A compiler from a K subset to GLSL fragment shaders: beyondloom.com/tools/specialk.html
ngn
ngn
@JohnE cool :) dyalog:co-dfns = k:.. co-lambdas?
co-dfns aspires to solve the much more challenging task of general computation on a GPU. Special-k is just a nice concise k-flavored syntax and sugar for writing fragment shaders that draw pretty animations on the screen.
on the plus side, though, since I'm only using GLSL ES in WebGL it should theoretically run on just about anything that can handle a modern-ish browser. Some people have said it works in Chrome on Android
I might integrate this thing with iKe eventually. You could do some really crazy shit if you could define uniforms and have both a shader and general oK program communicating with it
ngn
ngn
22:33
@JohnE i thought drawing pixels in iKe was strange. vector graphics and shaders should be more in the spirit of array languages.
well, when I first wrote iKe webGL was a lot less mature
ngn
ngn
@JohnE what about canvas?
iKe uses canvas. And it does have a vector drawing primitive
but the way you draw things in a shader program is completely inside-out from that perspective

« first day (404 days earlier)      last day (1131 days later) »