Masking is nice but as an alternative & still taking care not to remove
leading blanks q){x where 1b,1_not" "~':x}s:" the quick brown fox " "
the quick brown fox " Appears to be faster q)S:10000000#s q)\ts:5 {x
where not n&prev n:null x}S 197 1006639...
One thing to consider is that the seed value for the derived function
means any leading blanks will be removed. Can use prev q){x where
not(&':)" "=x}s:" the quick brown fox " "the quick brown fox " q){x
where not n&prev n:null x}s " the quick brown ...
Another alternative q)\ts:10000 {x#'x} 1+til 100 207 63616 q)\ts:10000
{sums[-1_t]_where t:til 1+x}100 106 130112 q){x#'x}[1+til
100]~{sums[-1_t]_where t:til 1+x}100 1b However, when applied to a large
vector, performance drops off as cut is expensiv...
Is this the behavior you're looking for? q)t:([] a:100?10;b:100?1.)
q)f:{[x;it]c1:(-1_(>':) (it+1)>x`a),0b;c2: 0.5>abs log ratios next
x`b;cond: $[1=it; c1; c1&c2];delete from x where cond|prev cond} q)count
{f[;y]/[x]}/[t;1 2] 56