/ Levenshtein distance / http://www.kx.com/a/k/examples/pm.k x is"as" y is "awash" p0 x y is f/[&1+#y;x=\:y;1+!#x] where f x y z is z(1+&)\(1_x)&(-1_x)-y p1 x y is f/[!1+#y;x=\:y;1+!#x] where f x y z is z(1+&)\(1_x)&(-1_x)-y x is"ctagc" y is"tgac"@draw 100000(4) r0 x y where (r0 x y is(!1+#y)+f/[-!1+#y;x=\:y;1+!#x]) where f x y z is &\z,(1+1_x)&(-1_x)-y r1 x y where (r1 x y is(!1+#y)+f/[&1+#y;x=\:y;1+!#x]) where f x y z is &\z,(1+1_x)&(-1_x)-y \ x:"as";y:"awash" p0:{{z(1+&)\(1_ x)&(-1_ x)-y}/[&1+#y;x=\:y;1+!#x]} /partial p1:{{z(1+&)\(1_ x)&(-1_ x)-y}/[!1+#y;x=\:y;1+!#x]} /total x:"ctagc";y:"tgac" 100000 _draw 4 / amino acid pattern r0:{w+{&\z,(1+1_ x)&(-1_ x)-y}/[-w:!1+#y;x=\:y;1+!#x]} r1:{(!1+#y)+{&\z,(1+1_ x)&(-1_ x)-y}/[&1+#y;x=\:y;1+!#x]}