@ngn I like backwards compatibility to the extent that I appreciate stability in a language. I don't want my knowledge of a language to go out of date too quickly.
@Razetime i don't think what most people mention as their language matches what they use in reality. most of my solutions are in python and c but i'd still like to advertise apl/j/k
@Razetime from PE's "about" section: "Problems 1 to 100 provide a wealth of helpful introductory teaching material and if you are able to respect our requirements, then we give permission for those problems and their solutions to be discussed elsewhere."
i was thinking, what if i make the k executable self-aware of its own size, and if it detects that it has a .k program concatented to its end, it executes it
this way turning a .k script into an executable program would be just: cat k file.k > myprogram
it'd probably be deeply nasty to try doing something like lopping off the end of a shell script, storing it as a temp file, and then executing the temp file
@ngn you could append zip files (even recursively) to the end. they have their index at the end, so they know how much to read. but then you need unzip available or within k.
@coltim one example of how nuanced testing overloads/all different types of args can get is this - n?dict (deal) only works intuitively if the keys are 0..#dict. am I clear on what the desired behavior even is here? not really, ha
then x could be different from ~~x. but since this is the stop condition of a while loop, it probably doesn't matter, as the truthiness of x is preserved
ok, here it is:
a:983
(x;p;fr):{(x;p;fr):x;x&~fr x}{(x;p;fr):x;(a!x*10;p+1;@[fr;x;:;p])}/(1;0;&a)
p-fr x
@Razetime here's another idea (tortoise&hare cycle detection): we start with 1 1 and keep multiplying by 10 100 (mod a) until they become equal again. if the last pair is 0 0, there is no recurring part in the decimal fraction. otherwise, the cycle length is the length of our sequence.
@ngn hmm the question's test examples could be wrong? there's this: "Given a positive integer n, (n>1 and n<10000), find the length of pattern in 1/n, if it's repeating. Otherwise, return any non-positive integer (e.g., cases: 1/5,1/94,1/22)."