diff --git a/ari.goal b/ari.goal index ac97b85..587badd 100644 --- a/ari.goal +++ b/ari.goal @@ -1,7 +1,7 @@ istbl:{and["d"=@x;&/"s"=@'!x;&/{(@'x)¿"ANSI"}x;&/(*ls)=ls:#'x]} / is x a dictionary-as-table reshape:{((*/x)#y){(-y)$x}/|1_x} / Implementation by anaseto, shared on Matrix shape:{-1_#:'*:\x} / Implementation by John Earnest, shared on k-tree -depths:{[l;ind] ,/(..?[(@x)¿"ANSI";p.o[x;p.ind+1];p.ind])'l} / list depths +depths:{[ind;l]?[(@l)~"A";,/o[ind+1]'l; (@l)¿"NSI";(#l)#ind; ind-1]} / list depths md.tbl:{[t;fmt] / helper k:!t; v:(..?[(@x)¿"nN";p.fmt$x;$'x])'.t; w:(-1+""#k)|(|/-1+""#)'v (k;v):(-w)!'´(k;v); "|"+("|\n|"/,/"|"/(k;"-"*w;+v))+"|"} @@ -10,8 +10,7 @@ md.lst:{[l;fmt] / helper ind:..x*" "; pfx:(ind'ds)+"- " "\n"/v;"\n"/pfx+v} sprintf.md:{[x;fmt]?[istbl x;md.tbl[x;fmt]; (@x)¿"ANSI";md.lst[x;fmt]; "n"=@x;fmt$x; $x]} / String print to Markdown -ltx.lq:{sub[rq/ "/;" ``"]sub[rx/(?m)^"/;"``"]x} / helper -ltx.rq:{sub[rq/" /;"'' "]sub[rx/(?m)"$/;"''"]x} / helper +ltx.lq:{sub[rq/ "/;" ``"]sub[rx/(?m)^"/;"``"]x}; ltx.rq:{sub[rq/" /;"'' "]sub[rx/(?m)"$/;"''"]x} / helpers ltx.tbl:{[t;fmt] / helper algn:!"r l"; algns:""/algn["S"=@'t] k:!t; v:(..?[(@x)¿"nN";p.fmt$x;$'x])'.t; w:(-1+""#k)|(|/-1+""#)'v