« first day (756 days earlier)      last day (779 days later) » 

5:51 AM
i might be missing something obvious but is there a straightforward k method of doing apl's partition ? (following @code_report's video)
'group' is closest
 
ngn
6:09 AM
@chrispsn cut?
except it takes a boolean mask instead of list of indices
oh, i was thinking of .. ignore me
maybe something like >': ?
 
6:42 AM
it's kinda fiddly
 
 
1 hour later…
ngn
7:44 AM
@chrispsn @JohnE i've just watched (a few minutes from) the video - the guy there is using ⊆'s special case for 0 to remove non-digits and split by them. i don't think k has a short equivalent of that.
 
8:23 AM
doesn't quite handle all input - a wip. k9. {c:":"; #=.'(c>)#'x@=+\" ">':c<x} link
 
ngn
@chrispsn i was thinking: we could replace non-digits with spaces, collapse runs of multiple spaces, and eval
d:`c$"0"+!10
#?.(" "/"  "\)/d@d?x
 
8:37 AM
@ngn i can't get this working in ngn/k
@ngn {#?.(#')#":"\":"&x} in k9 (char&char => char)
not sure why but #?.(#')#":"\":"& didn't work
 
ngn
@chrispsn i think the web version is too old and has a bug. just a mo..
strange. something's wrong with outdexing in wasm.
 
ngn
9:06 AM
i think i know what. i'll fix after lunch.
 
ngn
9:45 AM
 
@ngn local link?
 
ngn
0N is always 64bit in my impl and it was lost in wasm because sometimes i use size_t for indices
 
10:05 AM
how should aggregations over null work? +/1.1 2.2 0n
is 3.3 in k4 but 0n elsewhere. should we let the user filter 0n explicitly?
one possibility: have +/ etc be naive(and fast) and add "sum", "max", "avg" builtins which do more work (e.g. filter 0n, sum may use a compensated algorithm)
 
ngn
define "should"..
 
"what's your opinion about.."
 
ngn
for my own programming, i prefer stupid straightforward primitives. i can deal with 0N and 0n explicitly if i have to.
data scientists may not think this way
 
ngn
10:24 AM
@chrispsn what does "log W" mean there?
 
11:11 AM
@ngn yes, and 'WASM/Mobile'
There's more but it's best explained by @kelas
 
11:54 AM
@ngn strictly for consistency with other k's (strictly), what about allowing any amount of whitespace between numbers in the vector/strand notation? going off TiO, both kona and oK have that behavior
@chrispsn to translate this a couple tweaks are necessary: #?.'(#:)#":"\`c$":"&
@ktye the blurb here makes it sound like the "ignore nulls" part is to align with SQL o_0. How do other libs/languages handle nulls in aggregations?
 
@coltim julia wants you to be explicit: docs.julialang.org/en/v1/manual/missing/…
 
ngn
@coltim i can't decide. anybody else with a strong opinion?
 
12:13 PM
IMO strictly one space
 
@ktye thinking about it more, I don't know how often I've taken advantage of nulls being ignored. I know I've been bitten by the "running an aggregation function strictly on a list of nulls", which caused some headaches when using min/max (introducing infinities in weird places)
re whitespace in stranding: I don't know if it'll ever really come up in practice in people's actual code (I don't see any reason why someone would use more than one space). on one hand allowing arbitrary whitespace is consistent with the rest of the language, but I guess vector/strand notation is somewhat of a special form. it would have uses golfing, as in this example
 
ngn
the main reason for people wanting this is alignment
 
hmm, good point! could even result in "pretty-printed" output still being evaluate-able
 
@ngn @coltim would spaces in symbol lists be a similar case?
 
@ktye and it looks like numpy has a separate nansum() function to treat NaNs as 0's
 
ngn
12:25 PM
@chrispsn maybe. i'm not sure.
 
@ngn or copy paste from somewhere else
 
12:53 PM
#?.(97>)#'(30<-':)^ (or similar) could work too
 
1:28 PM
or #?.";"&(30<-':)^
 
@chrispsn very clever!
 
hmm doesn't work on empty string
 
ngn
how does it work? what is f^?
f^ seems to be just {(&f x)^x} (like good old cut)
 
1:50 PM
yeah, ^ is cut
 
ngn
is there an option to enable round-tripping?
 
not sure
my last answer above cuts where the gap is too big for it to be anything other than an int -> char transition, then turns all chars into semicolons, then evaluates (plain semicolons are empty statements so only the last one gets picked up)
 
ngn
ah..
yeah, this is nice
 
but it doesn't work where there's trailing chars or an empty string
 
ngn
my eyes hurt after a few minutes staring at kelas' web repl :)
. on a list of strings penetrates the list?!
 
2:04 PM
yep, in k9
 
ngn
@chrispsn is there no eval/apply anymore?
 
isn't . still eval?
oh, as in dyadic?
 
ngn
previously .(x;y) was the same as x@y
and .(x;y;z) was x[y;z]
 
oh! i have never used that
not sure
#?(`i=@')#.";"&(30<-':)^  / deals with empties and trailing chars
 
ngn
@chrispsn you could also do ." "/$ instead of (`i=@')#
(handles trailing letters but fails for the empty string)
now this is strange: ?(0;"a") -> domain error
 
2:23 PM
heh
and .,";" fails but .";;" is ok
i'll report it
 
@chrispsn Where?
 
can this be converted easily to apl? https://chat.stackexchange.com/transcript/message/57524332#57524332

explanation: https://chat.stackexchange.com/transcript/message/57524633#57524633
 
Ah, that's basically what I was doing on one of my many implementations.
 
@Adám cool - thanks for having a look
 
2:57 PM
doing a simple string cat-and-eval seems faster than the cut approach
{#?(`=@')_.";"&"(",x,")"}
 
ngn
@chrispsn is there still a way to parse? `p@ doesn't work
 
@ngn not at the moment
 
3:16 PM
been playing around with some ideas for utility functions; came up with this for insert
was thinking of extending it to take a list of indices as well, which would be combine (e.g. apply some rank/depth-reducing function to the values at those indices, removing them from the input and inserting the new value at the first index)
 
 
3 hours later…
ngn
6:02 PM
@coltim that sounds very much like splice
 
 
3 hours later…
8:33 PM
@ngn yeh, it's definitely modeled after splice. Was there ever a "formal" version of it? I know oK has it, although I'm unsure of what I think about the "interval" aspect of it
 
ngn
@coltim "formal" - nothing ever is in k
 
 
1 hour later…
9:53 PM
my first idea on that puzzle was something like this, which is pretty awful overall:

{?(.*|:)'0N 2#x@.=+\~~':~^"0123456789"?x:"x",x}
prepend with a letter to ensure groups alternate [non-digits,digits], then crack at run breaks, refold, drop words and evaluate
 
10:10 PM
have you guys already tried something like

?.(`c$.[255#32;d;::;d:48+!10])@
oops, I mean
?.(`c$.[255#32;d:48+!10;::;d])@
and in oK specifically it could be golfed down to

?.(.[255#" ";d:48+!10;::;d])@
 

« first day (756 days earlier)      last day (779 days later) »