« first day (825 days earlier)      last day (710 days later) » 

1:40 PM
@ngn in my ongoing adventures with edge cases, I've stumbled across two things: -2!-4 -3 -2 -1 returning -2 -1 -1 0 instead of -2 -2 -1 -1 like other K's/languages, and &() returning ,!0 instead of !0 (is that b/c of deep where?)
 
ngn
@coltim -2! - right, that makes sense. will fix.
@coltim &() - it's a consequence of () not being the same as !0, and yeah, it ends up doing deep where
with hindsight, removing prototypes from ngn/k was a mistake :(
 
@ngn ah, is it because () has the same type as e.g. (1 2 3;4 5 6), with the latter resulting in deep where?
 
ngn
@coltim yes, currently () is a generic list and it acts as its own prototypical element
for instance 2#() is (();())
this is the only cycle in the (otherwise well-founded and immutable) object graph
 
could () be special cased here to not trigger the deep-where logic, or am I just totally off base here?
 
ngn
1:57 PM
@coltim what if the user does mean to use deep where?
the root of the problem, i suspect, is that you got () from somewhere, when it should really have been !0
 
@ngn ah, it looks like the () came from a int'list where there weren't enough items
 
ngn
@coltim ah, right
so it should have been 0#,!0 (an empty list with prototypical element !0)
but since we don't store prototypes, that ends up being the same as ()
 
@ngn maybe &,()?
 
ngn
2:12 PM
if i special-case it, that would be like treating the symptoms instead of the root cause of the problem
 
that feels tricky since some operations have more defined output on empty lists e.g. #(), others may impose a type on that empty list (<()), others may just respect the original typing of the empty list (int_list), and this isn't even covering reductions/scans where sometimes you want them to return the identity element and other times you want to preserve the empty-list-iness of the input
oh no, i've gone cross-eyed
 
ngn
2:34 PM
@coltim (-x)!-y fixed
 
@ngn hmm, but int_list appears to preserve the typing of empty lists
 
ngn
2:53 PM
@coltim (-x)%y fixed too
@coltim well, if it can, it does
but not in cases like 2_(0 1;2 3) - then information is lost
 
ngn
3:21 PM
@Bubbler idea for shortening your latest answer
 
 
6 hours later…
9:07 PM
hmm, borrowing from oK, I think -int'list could be some sort of padded-sliding-windows thing
e.g. something like this
 
 
2 hours later…
10:53 PM
@ngn I thought of something similar, but abandoned because it's O((log n)^2) which exceeds the time complexity limit
Nice snippet to remember though
 
11:09 PM
@Bubbler I can't claim to understand all the nuances here, but what about q:2/=#b:2\x in place of q:(-1+#b:|2\x)(2*)\1;?
 
@Bubbler the challenge has been edited to allow any O((log n)^k) time, so that'd be okay
 
11:27 PM
Damn, didn't notice the edit
@coltim It sounds good then. I got to 36 bytes with it
 

« first day (825 days earlier)      last day (710 days later) »