« first day (403 days earlier)      last day (1132 days later) » 

8:09 AM
do you think range can be expressed more simply? even the 1_ feels excessive
 r:{1_x(1+)\-1}
 r 5
0 1 2 3 4
 r 0
!0
(that's k7 syntax)
icsa did a simpler one but it uses where, and where is probably best written using range: {&x#1}
 
if you want to avoid loops, you have to define first which primitives are not to be used.
 
i think length is ok
i'm not worried about avoiding loops
something recursive could do it but that feels slow
 
8:25 AM
@chrispsn count: +/x~'x
 
i wonder how far you could get without storing array lengths in the list data structure
just always allocate in the next contiguous sequence of memory and subtract the next pointer from this one to get the array length
@ktye match feels like something that could be implemented recursively, but i'll add it in because maybe this could work with various 'starting rosters'
 
9:30 AM
heh, you could have definitions that are mutually recursive - fine as long as one hits a base case
 
 
1 hour later…
10:53 AM
how to define empty int list without ! or drop or take :P
also weird results in k9
2019-09-25 14:44:44 2core 3gb avx2 © shakti l test
 {(~x=#:){0,x+1}/!0}5
0 1 2 3 4

2020.04.12 (c) shakti
 {(~x=#){0,x+1}/:!0}5
~5=#
 {x{0,x+1}/`i$()}5
0 1 2 3 4
 
i think this is because in k9 the valence of a composition is undefined before application. while needs an explicid monad.
 
@ktye would that apply here too?
2019-09-25 14:44:44 2core 3gb avx2 © shakti l test
 {x{0,x+1}/`i$()}5
0 1 2 3 4

2020.04.12 (c) shakti
 {x{0,x+1}/:`i$()}5
5
 
@chrispsn these are for loops (not while) and there are no compositions.
 
11:14 AM
see also:
 {{~y=#x}[;x]{0,x+1}/:!0}5
{~y=#x}[;5]
so even if you make it an explicit monad condition, it doesn't work out
it's just returning the p (or n, as the case may be)
 
11:56 AM
 {+/{1}'x}"hello"
5
and indeed +/{1}'
 
ngn
12:48 PM
@chrispsn k9 doesn't have n f/: yet but it's easy to implement it through f/:
here N[n;f;a] is n f/:a, Ns[n;f;a] is n f\:a, W[f;g;a] is f g/:a, and Ws[f;g;a] is f g\:a
2020.04.12 (c) shakti
 N:{*|{$[*y;(-1+;x)@';]y}[y]/:(x;z)}
 {N[x;{0,x+1};`i$()]}5
0 1 2 3 4
 
 
4 hours later…
4:27 PM
@chrispsn maybe {-1+\x#1} ?
 
4:50 PM
or {-1+\x(1,)/()}5
(both k6 syntax)
 

« first day (403 days earlier)      last day (1132 days later) »