[Jprogramming] i. with fill
Joe Bogner
joebogner at gmail.com
Wed Apr 11 20:35:16 UTC 2018
I often get tripped up with different trailing shapes when using i. with
char arrays. I must not be the only one[1]
Does this look like a suitable utility to deal with it or is there a more
common way?
Y1=:0&{::
Y2=:1&{::
idotfill =. (( ( (_,]) {. Y1@[) i. ((_,]) {. Y2@[) ) {:@$@Y2 >. {:@$@Y1) f.
idotfill (>'SF';'SY';'PK ');(>'SF';'SY')
0 1
compare with
NB. different trailing shape
(>'SF';'SY';'PK ') i. (>'SF';'SY')
3 3
NB. remove the trailing space on PK
(>'SF';'SY';'PK') i. (>'SF';'SY')
0 1
[1] - "y must match the entire row of x (including any trailing fill
letters) for (i.) to find it. Otherwise (i.) returns (#x) (signifying "not
found"), concealing your error."
http://code.jsoftware.com/wiki/Vocabulary/idot#dyadic
More information about the Programming
mailing list