D 2024-11-09T18:26:19.886
J icomment For\sworking\swith\sflat\slists\s-\sthis\scan\ssometimes\sbe\sa\sbit\sannoying/unintuitive.\r\n\r\n\s\s%\slsearch\s-stride\s3\s-index\s{0\s0}\s-subindices\s-all\s-inline\s{f1\sa1\sa2\sf2\sb1\s""}\s*\r\n\s\sf1\sf2\r\n\r\n\s\s%\slsearch\s-stride\s3\s-index\s{1\s0}\s-subindices\s-all\s-inline\s{f1\sa1\sa2\sf2\sb1\s""}\s*\r\n\s\sa1\sb1\r\n\r\n\s\s%\slsearch\s-stride\s3\s-index\s{2\s0}\s-subindices\s-all\s-inline\s{f1\sa1\sa2\sf2\sb1\s""}\s*\r\n\s\selement\s0\smissing\sfrom\ssublist\s""\r\n\r\nUsually\sI'd\sjust\sreconfigure\sthe\sdatastructure\sto\suse\slists\sof\slists\s-\sbut\sthere\sare\ssome\sthings\sfor\swhich\sa\sflat\slist\sis\smore\ssuited.\r\n\r\ne.g\sin\sconsole\swork;\sfor\soutputting\sa\slist\sof\swords\sin\scolumns\s-\swhere\sthe\snumber\sof\scolumns\smight\schange\sbased\son\savailable\sdisplay\swidth.\r\n\r\n\s\s\s\sproc\sfiller_count\s{listlen\snumcolumns}\s{\r\n\s\s\s\s\s\s\s\sexpr\s{($numcolumns\s-\s($listlen\s%\s$numcolumns))\s%\s$numcolumns}\r\n\s\s\s\s}\s\r\n\s\s\s\sproc\scol\s{list\snumcolumns\scolindex\s{blank\sNULL}}\s{\r\n\s\s\s\s\s\s\s\slsearch\s-stride\s$numcolumns\s-index\s[list\s$colindex\s0]\s-subindices\s-all\s-inline\s[list\s{*}$list\s{*}[lrepeat\s[filler_count\s[llength\s$list]\s$numcolumns]\s$blank]]\s*\r\n\s\s\s\s}\r\n\s\s\s\s#...\sremainder\sof\sblock\sdisplay\scode\somitted.\r\n\r\n\s\s\s\s%col\s{a\sbunch\sof\swords\sto\sput\sin\sa\sgrid\setc}\s3\s0\s;#retrieve\sthe\sfirst\scolumn\sof\sthe\swords\sarranged\sinto\sa\stotal\sof\s3\scolumns\sso\syou\scan\sdetermine\sthe\swidth\srequired\sfor\sthe\scolumn.\r\n\s\s\s\sa\swords\sin\setc\r\n\r\nThis\swill\sfail\sif\sthe\swordlist\scontains\san\sempty\sstring,\sor\sif\syou\sset\sthe\s'blank'\sargument\sto\sempty\sstring.\r\n\r\nIt\scan\sbe\sworked\saround\sby\susing\s{""}\sor\ssome\sother\scharacter\sfor\sempty-string\swords\sin\sthe\slist\sand\sfor\sthe\s'blank'\sargument\s-\sor\sof\scourse\sjust\sby\susing\ssomething\sother\sthan\sthe\slsearch\s-stride\smechanism\sto\sbuild\sthe\slists.\r\n\r\nIt\sdoes\sseem\ssomething\sof\sa\spity\sthis\sdoesn't\swork\sas\smight\sfirst\sbe\sexpected\s-\sbut\sI\sguess\sthe\strade-off\smight\sbe\sdue\sto\smaintaining\sthe\sability\sto\sdifferentiate\sempty\sstring\svalues\svs\smissing\sitems,\sor\sin\saiding\serror\sdetection\sin\slist\sstructures?
J login juliannoble2
J mimetype text/plain
K edebb6a4ff741f7e7ddcaa17355640a586b52502
U juliannoble2
Z db3f9cf71da48d7f4a5c229fdf2cd34b